← Back to Discord Forum


Hello all,

did anyone managed to run playwring in browserless or any other external chrome?

I run it in docker I have setup

const browser = await chromium.connect('ws://localhost:3000');

and when I run test its stuck on connect

2023-10-25 16:45:29 2023-10-25T14:45:29.675Z browserless:chrome-helper Chrome PID: 42
2023-10-25 16:45:29 2023-10-25T14:45:29.676Z browserless:chrome-helper Finding prior pages
2023-10-25 16:45:29 2023-10-25T14:45:29.762Z browserless:chrome-helper Found 1 pages
2023-10-25 16:45:29 2023-10-25T14:45:29.763Z browserless:chrome-helper Setting up page F113A77F2091E39667C62EAEFC84CD87
2023-10-25 16:45:29 2023-10-25T14:45:29.763Z browserless:chrome-helper Injecting download dir "/usr/src/app/workspace"
2023-10-25 16:45:29 2023-10-25T14:45:29.763Z browserless:system Chrome launched 506ms
2023-10-25 16:45:29 2023-10-25T14:45:29.763Z browserless:job R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Starting session.
2023-10-25 16:45:29 2023-10-25T14:45:29.763Z browserless:job R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Proxying request to /devtools/browser route: ws://
2023-10-25 16:45:29 2023-10-25T14:45:29.764Z browserless:chrome-helper Setting up file:// protocol request rejection
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:server R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Recording successful stat and cleaning up.
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:job R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Cleaning up job
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:job R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Browser not needed, closing
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:chrome-helper Shutting down browser with close command
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:server Current workload complete.
2023-10-25 16:45:29 2023-10-25T14:45:29.779Z browserless:chrome-helper Sending SIGKILL signal to browser process 42
2023-10-25 16:45:29 2023-10-25T14:45:29.783Z browserless:chrome-helper Removing temp data-dir /tmp/browserless-data-dir-CM4OFT
2023-10-25 16:45:29 2023-10-25T14:45:29.785Z browserless:job R8VVH6348N3MXUARJG2HZ1EBBZ5PU04W: Browser cleanup complete.
2023-10-25 16:45:29 2023-10-25T14:45:29.797Z browserless:chrome-helper Browser process exited with code 0 and signal null, cleaning up
2023-10-25 16:45:29 2023-10-25T14:45:29.799Z browserless:chrome-helper Temp dir /tmp/browserless-data-dir-CM4OFT removed successfully

This thread is trying to answer question "How can I set baseURL for current context and page when connection over CDP, without creating new context and page?"

5 replies

try connectOverCDP instead of connect.

Actually did it and override the fixtures so it doesnt have to be defined in every test and works! Thanks

I feel like its almost done, but I have a issue setting baseUrl for the browser connected over CDP.

I have this:

export const test = base.extend<MyFixtures>({

  browser: async ({ browser }, use) => {
    if (!process.env.CI) {
      browser = await chromium.connectOverCDP('http://localhost:3000');
    } else {
      browser = await chromium.launch();
    await use(browser);
    await browser.close();

  page: async ({ browser }, use) => {
    let page: Page;
    if (!process.env.CI) {
      const defaultContext = browser.contexts()[0];
      page = defaultContext.pages()[0];
    } else {
      const context = await browser.newContext();
      page = await context.newPage();
    await page.setViewportSize({ width: 1336, height: 720 });
    await use(page);

when I try:

test('Browser test', async ({ page }) => {
  await page.goto('/docs/intro');
  await page.waitForURL('https://playwright.dev/docs/intro');

it fails on

navigating to "/docs/intro", waiting until "load"

But I would prefer to set the baseURL and not typing the whole URL

But still wondering how can I set baseURL for current context and page when connection over CDP, without creating new context and page

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.