SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.19k stars 8.11k forks source link

[🐛 Bug]: Chrome - org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools issue #14416

Open haridanapana opened 3 weeks ago

haridanapana commented 3 weeks ago

What happened?

Hello , i have installed Selenium Grid using K8s which uses image Tag 4.18.1-20240224 and while executing the script i am getting Details which we are using as part of testing Browser Version : 126.0.6478.114 Selenium Chrome Node image Tag: 4.18.1-20240224(tried with latest release 4.23 also) and chart Version : 0.28.4 Operating system : Linux Java version: 17.0.11 Error Message 2024-08-20 10:54:05 [ERROR] [TestNG-PoolService-6]: com.highradius.utilities.DriverUtils - error while performing wait operation - org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=126.0.6478.114) Build info: version: '4.18.1', revision: 'b1d3319b48' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.14.0-362.18.1.el9_3.0.1.x86_64', java.version: '17.0.11' Driver info: org.openqa.selenium.remote.RemoteWebDriver Command: [021e4565b36b00bbe6664ff97ec58459, findElement {value=//a[contains(@class,'submitButton')]//span[text()='SUBMIT'], using=xpath}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 126.0.6478.114, chrome: {chromedriverVersion: 126.0.6478.63 (df799988fdc9..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34541}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://selenium-grid-selenium..., se:cdpVersion: 126.0.6478.114, se:vnc: ws://selenium-grid-selenium..., se:vncEnabled: true, se:vncLocalAddress: ws://10.55.254.13:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

can anyone help me on this issue.

Thanks,

How can we reproduce the issue?

Install Selenium grid of Version 4.18.1-20240224 using Kubernetes and and run a selenium Script

Relevant log output

Session ID: 021e4565b36b00bbe6664ff97ec58459
2024-08-20 10:54:05 [DEBUG] [TestNG-PoolService-6]: com.highradius.utilities.ChromeDriverUtils - Entering login():  user=test_core_23474,pwd=********
2024-08-20 10:54:05 [DEBUG] [TestNG-PoolService-6]: com.highradius.utilities.HrcPage - Entering getWebElementDetails():  elementName=SUBMIT
2024-08-20 10:54:05 [DEBUG] [TestNG-PoolService-6]: com.highradius.utilities.MailUtilEx - Entering sendScenarioStatus(): 
2024-08-20 10:54:05 [DEBUG] [TestNG-PoolService-6]: com.highradius.utilities.MailUtilEx - Exiting sendScenarioStatus():  iArgs=null,oArgs=FAILED
2024-08-20 10:54:05 [ERROR] [TestNG-PoolService-6]: com.stepdefinitions.Hooks - Unable to capture the screenshot
2024-08-20 10:54:05 [ERROR] [TestNG-PoolService-6]: com.stepdefinitions.Hooks - Unable to capture the screenshot
2024-08-20 10:54:05 [ERROR] [TestNG-PoolService-6]: com.stepdefinitions.Hooks - error while taking screenshotorg.openqa.selenium.WebDriverException: disconnected: not connected to DevTools
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=126.0.6478.114)
Build info: version: '4.18.1', revision: 'b1d3319b48'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.14.0-362.18.1.el9_3.0.1.x86_64', java.version: '17.0.11'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [021e4565b36b00bbe6664ff97ec58459, screenshot {}]
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 126.0.6478.114, chrome: {chromedriverVersion: 126.0.6478.63 (df799988fdc9..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34541}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://selenium-grid-selenium..., se:cdpVersion: 126.0.6478.114, se:vnc: ws://selenium-grid-selenium..., se:vncEnabled: true, se:vncLocalAddress: ws://10.55.254.13:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

Operating System

Linux

Selenium version

all Selenium 4 version tested with 4.18.1-20240224 and 4.23

What are the browser(s) and version(s) where you see this issue?

chrome - 126.0.6478.114

What are the browser driver(s) and version(s) where you see this issue?

chromedriverVersion: 126.0.6478.63

Are you using Selenium Grid?

4.18.1-20240224

github-actions[bot] commented 3 weeks ago

@haridanapana, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] commented 3 weeks ago

Hi, @haridanapana. Please follow the issue template, we need more information to reproduce the issue.

Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue.

Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough.

Reply to this issue when all information is provided, thank you.

diemol commented 3 weeks ago

Please note we only support the official Helm chart. You'd need to provide the script that shows that error as well.

haridanapana commented 3 weeks ago

Hi diemol, Thanks for your reply.

we are using the official helm chart provided in the below https://github.com/SeleniumHQ/docker-selenium/blob/trunk/charts/selenium-grid/README.md

We have installed the selenium Grid of version 4.23 using K8s and ran the selenium scripts and observed the devtools issue.

Below is the script private ChromeOptions createChromeRemoteDriverOptionsHeadless(String downloadFilepath, ChromeOptions options) { HashMap<String, Object> prefs = new HashMap<>();

    prefs.put("download.default_directory", downloadFilepath);
    prefs.put("download.prompt_for_download", "False");
    options.setExperimentalOption("prefs", prefs);
    options.addArguments("--headless=new");
    options.addArguments("--window-size=" + 2560 + "," + 1440);
    options.addArguments("--disable-gpu");
    options.addArguments("--disable-dev-shm-usage");
    options.addArguments("--no-sandbox");
    options.addArguments("--disable-dev-tools");

    return options;
}

Note: Is there any approach to install the chrome browser of version less than 123. we have tested in normal standalone VM with this 122 chrome browser version we didnt observe the devtools issue.

Thanks,

diemol commented 3 weeks ago

You are only sharing the options. This issue might help you https://github.com/SeleniumHQ/selenium/issues/13185

haridanapana commented 3 weeks ago

the above solution didnt work . below us the code snippet public class DevToolsHandling { public static void main(String[] args) { WebDriverManager.chromedriver().setup(); ChromeOptions options = new ChromeOptions(); options.addArguments("--disable-dev-shm-usage"); options.addArguments("--disable-gpu"); options.addArguments("--no-sandbox"); options.addArguments("--disable-dev-tools");

    WebDriver driver = new ChromeDriver(options);
        driver.get("https://example.com");
 }

} Error 2024-08-20 10:54:05 [ERROR] [TestNG-PoolService-6]: com.stepdefinitions.Hooks - error while taking screenshotorg.openqa.selenium.WebDriverException: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=126.0.6478.114) Build info: version: '4.18.1', revision: 'b1d3319b48' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.14.0-362.18.1.el9_3.0.1.x86_64', java.version: '17.0.11' Driver info: org.openqa.selenium.remote.RemoteWebDriver Command: [021e4565b36b00bbe6664ff97ec58459, screenshot {}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 126.0.6478.114, chrome: {chromedriverVersion: 126.0.6478.63 (df799988fdc9..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34541}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://selenium-grid-selenium..., se:cdpVersion: 126.0.6478.114, se:vnc: ws://selenium-grid-selenium..., se:vncEnabled: true, se:vncLocalAddress: ws://10.55.254.13:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

VietND96 commented 3 weeks ago

What if you remove this arg options.addArguments("--disable-dev-tools");?

diemol commented 3 weeks ago

@haridanapana I am not sure if you read the issue I linked, because it is suggesting to remove --disable-dev-tools as suggested above.