Is there a way to connect to my existing DotNetBrowser session using playwright

333 Views Asked by At

I want to automate the web view of the hybrid screen (DotNetBrowser inside a .Net Container) using Playwright automation tool.

I have checked by providing the value(URL of the Web view) as EndPoint within connectOverCDP method but it dint work.

The following is the typescript code which i have tried:

const pw = require('playwright');

(async () => { const browser = await pw.chromium.connectOverCDP({ Endpoint: "``http://localhost:8888/``" });

const context = await browser.newContext(); console.log(browser); await context.screenshot({Path :'screenshot.png'}) })();

Please confirm if playwright would be able to connect to the DotNetBrowser ,if yes, please do share the details.

Did try to run the above mentioned code using Playwright automation tool,but unable to connect the existing DotNetBrowser using playwright

Expected Result: Playwright to connect to existing DotNetBrowser session.

Any help or a simple example to get me pointed in the right direction would be much appreciated.

1

There are 1 best solutions below

0
Vladimir On

I suppose that playwright works through the Chromium remote debugging port.

If so, then you need to configure DotNetBrowser with the required debugging port as show in the doc at https://dotnetbrowser-support.teamdev.com/docs/guides/gs/engine.html#remote-debugging-port

For example:

IEngine engine = EngineFactory.Create(new EngineOptions.Builder
{
    RemoteDebuggingPort = 8888
}.Build());