1
votes

I'm using the docker image selenium/standalone-chrome:4.0.0 to run selenium, and yesterday just started to throw errors.

This is are my chrome web driver options:

val chromeOptions = ChromeOptions()

chromeOptions.setHeadless(isHeadless)
chromeOptions.addArguments(
            "--whitelisted-ips",
            "--no-sandbox",
            "--disable-extensions",
            "start-maximized",
            "enable-automation",
            "--disable-infobars",
            "--disable-dev-shm-usage",
            "--disable-browser-side-navigation",
            "--disable-gpu", "window-size=1980,960"
        )

The errors I'm getting are:

session deleted because of page crash from tab crashed (Session info: headless chrome=81.0.4044.92) Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'ip-10-0-3-6.eu-west-1.compute.internal', ip: '10.0.3.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.152-127.182.amzn2.x86_64', java.version: '1.8.0_242' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 81.0.4044.69 (6813546031a4b..., userDataDir: /tmp/.com.google.Chrome.LfBvAx}, goog:chromeOptions: {debuggerAddress: localhost:40023}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: none, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} Session ID: bfce4fb924589b8929dc0351195352e1 *** Element info: {Using=id, value=XXXXX`

invalid session id Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'ip-10-0-3-6.eu-west-1.compute.internal', ip: '10.0.3.6', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.152-127.182.amzn2.x86_64', java.version: '1.8.0_242' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.92, chrome: {chromedriverVersion: 81.0.4044.69 (6813546031a4b..., userDataDir: /tmp/.com.google.Chrome.LfBvAx}, goog:chromeOptions: {debuggerAddress: localhost:40023}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: none, platform: LINUX, platformName: LINUX, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true} Session ID: bfce4fb924589b8929dc0351195352e1

If I need to add more code please let me know.

Thanks in advance!

1
Do see my answer and let me know if it helps - AzyCrw4282

1 Answers

1
votes

It seems like some version(s) of Chrome seem to crash in Docker containers, on certain pages, due to too small /dev/shm.

To solve it, simply mount -v /dev/shm:/dev/shm

Or, longer, create a big shm

  1. Started in privileged mode: docker run --privileged

  2. Fix small /dev/shm size

docker exec $id sudo umount /dev/shm
docker exec $id sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm

Above is taken from here and credit goes to the respective owner.

You can also use Firefox and this should work without any problem.