selenoid: Can not connect to Selenoid container by puppeteer using websocket

Issue overview

I get an error when try to connect to selenoid container via websocket. Error looks like:

  Error {
    message: 'Protocol error (Target.getBrowserContexts): Target closed.',
  }

What steps were done:

  1. Download specific selenoid image ./cm selenoid download vaniapooh/chrome:71.0-devtools --force
  2. Configure for downloading chrome 71 ./cm selenoid configure --browsers chrome:71.0
  3. Start Selenoid
  4. Create a browser session via request:
const { data } = await axios.post(
    `http://${selenoidUrl}:4444/wd/hub/session`,
    {
      "desiredCapabilities":
        {
          browserName: "chrome",
          "selenoid:options": {
            sessionTimeout: '3m',
            enableVnc: true
          }
        }
    }
  );
  1. Get from response sessionId
  2. Try to make connection by puppeteer via websocket:
const browser = await puppeteer.connect(
    { browserWSEndpoint: `ws://${selenoidUrl}:4444/devtools/${sessionId}` }
  );

At this point a get an error.

Reproducible repository

https://github.com/CrispusDH/puppeteer-ava-selenoid

How to run:
  1. Firstly, install all dependencies npm i
  2. Download Configuration Manager tool npm run cm:install
  3. Run test npm run stest (in background it will download and setup Selenoid as it needed)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Works

@CrispusDH your test now seems to work with aerokube/selenoid:latest and vaniapooh/chrome:75.0-devtools as image. Btw, your test is not closing sessions correctly (should do driver.quit() on tear down).