selenium.WebDriverException: unknown error: session deleted because of page crash from tab crashed
Asked Answered
B

3

6

Note: My question was closed earlier, I tried solutions mentioned here - unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed with ChromeDriver Selenium -- added these options - options.addArguments("--disable-dev-shm-usage"); options.addArguments("--no-sandbox"); -- Still I see the issue

Seeing below errors for single test in some scenarios in between when running in selenium grid:

Hooks method1:

org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash
from tab crashed
  (Session info: chrome=80.0.3987.106)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-37JVVAA', ip: '169.254.210.134', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.106, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: /tmp/.com.google.Chrome.TQ7Z9v}, goog:chromeOptions: {debuggerAddress: localhost:41695}, 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, webdriver.remote.sessionid: 2ac66b1a001b0b8c6c24da9821b...}
Session ID: 2ac66b1a001b0b8c6c24da9821b8f1e2

Hooksmethod2:

org.openqa.selenium.NoSuchSessionException: invalid session id
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-37JVVAA', ip: '169.254.210.134', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.106, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: /tmp/.com.google.Chrome.TQ7Z9v}, goog:chromeOptions: {debuggerAddress: localhost:41695}, 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, webdriver.remote.sessionid: 2ac66b1a001b0b8c6c24da9821b...}
Session ID: 2ac66b1a001b0b8c6c24da9821b8f1e2

Hooksmethod3:

org.openqa.selenium.WebDriverException: Session [2ac66b1a001b0b8c6c24da9821b8f1e2] was terminated due to BROWSER_TIMEOUT
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-37JVVAA', ip: '169.254.210.134', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.106, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: /tmp/.com.google.Chrome.TQ7Z9v}, goog:chromeOptions: {debuggerAddress: localhost:41695}, 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, webdriver.remote.sessionid: 2ac66b1a001b0b8c6c24da9821b...}
Session ID: 2ac66b1a001b0b8c6c24da9821b8f1e2

We have 3 sequential methods in hooks - looks like first issue is the root cause, but am not sure.

Following are the options used for driver:

            ChromeOptions options = new ChromeOptions();
            options.addArguments("start-maximized");
            options.addArguments("--disable-infobars");
            options.addArguments("--disable-extensions");
            options.addArguments("chrome.switches", "--disable-extensions");
            options.addArguments("--disable-gpu");
            options.addArguments("--disable-dev-shm-usage");
            options.addArguments("--no-sandbox");
            options.addArguments("--disable-notifications");
            options.addArguments("--disable-popup-blocking");
            options.addArguments("enable-automation");
            options.addArguments("--disable-dev-shm-usage");
            options.addArguments("--disable-browser-side-navigation");
            options.addArguments("--dns-prefetch-disable");
            options.setPageLoadStrategy(PageLoadStrategy.NONE);
            options.setExperimentalOption("useAutomationExtension", false);
            driver = new RemoteWebDriver(new URL(AWS_URL), options);

Following are the overrides we used in kubernetest yaml file:

  chrome:
    ## Enable the creation of a node-chrome pod
    enabled: true
    replicas: 65
    javaOpts: "-Xmx1024m -XX:+UseSerialGC"
    resources:
      limits:
        cpu: ".5"
        memory: "1000Mi"
    env:
      sessionTimeout: 60
  hub:
    env:
      sessionTimeout: 60
    ##gridBrowserTimeout
    gridBrowserTimeout: 240
    livenessTimeout: 15
    readinessTimeout: 15
    gridJettyMaxThreads: 1024
    gridTimeout: 60
    gridCleanUpCycle: 5000
    gridNewSessionWaitTimeout: -1
    javaOpts: "-Xmx1024m -XX:+UseSerialGC"

    ## ref: http://kubernetes.io/docs/user-guide/compute-resources/
    resources:
      limits:
        cpu: "3"
        memory: "2048Mi"
 Please help
Bibeau answered 13/3, 2020 at 2:3 Comment(0)
C
4

I had the same issue and it was resolved by adding the -/dev/shm:/dev/shm for the chrome container in the docker-compose.yml file
Refer: https://github.com/SeleniumHQ/docker-selenium

chrome:
 image: selenium/node-chrome
 depends_on:
  - selenium-hub
 volumes:
  - /dev/shm:/dev/shm
 environment:
  HUB_PORT_4444_TCP_ADDR: selenium-hub
  HUB_PORT_4444_TCP_PORT: 4444
  NODE_MAX_SESSION: 2
  NODE_MAX_INSTANCES: 2
Currier answered 8/7, 2020 at 11:24 Comment(0)
A
1

I had the same issue for Chrome and Firefox. I was able to resolve it by increasing the size (shm_size) of both containers.

version: "3"
services:
  hub:
    image: selenium/hub
    ports:
      - "4444:4444"
  chrome:
    image: selenium/node-chrome
    shm_size: '1gb'
    depends_on:
      - hub
    environment:
      - HUB_HOST=hub
  firefox:
    image: selenium/node-firefox
    shm_size: '1gb'
    depends_on:
      - hub
    environment:
      - HUB_HOST=hub
Alkaloid answered 8/8, 2020 at 8:3 Comment(0)
J
0

This may be caused by a memory limit on Docker itself. A limit of 2GB reproduces this issue and 4GB does not. This can be changed in Docker Dashboard > Settings > Resources.

Jurat answered 7/2 at 1:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.