SeleniumHQ / selenium

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

[🐛 Bug]: Latest ChromeDriver version fails randomly with 'Command duration or timeout' error #14060

Closed cybertuck closed 1 month ago

cybertuck commented 1 month ago

What happened?

Worked fine with ChromeDriver 105.0 Problem appears when I switched to the latest version 125.0

How can we reproduce the issue?

My scenario: I open modal window and click 'Cancel' button in this new window
(click Button is visible and displayed)
Running via Selenoid for 1 test in one thread 
1-2 out 10 executions are failing intermittently.

Relevant log output

2024-05-31 15:12:02 [SwitchWindowsPage:36] [INFO]  - Switched to new window. New page title is 'Edit Properties'

org.openqa.selenium.WebDriverException: 
Command duration or timeout: 469 milliseconds
Build info: version: '4.18.0', revision: 'b6bf9de7cc*'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [f24afa1c9266f3abd0d794077c9410df, clickElement {id=f.AD83DE82E970486A4B6F495C39F7B00D.d.19FA7CF0FC25AC7953861693D58A6922.e.424}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 125.0.6422.60, chrome: {chromedriverVersion: 125.0.6422.60 (3ac3319bff9f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34273}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), 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}
Element: [[RemoteWebDriver: chrome on linux (f24afa1c9266f3abd0d794077c9410df)] -> css selector: input[value='Cancel']]
Session ID: f24afa1c9266f3abd0d794077c9410df

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:221)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:170)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:223)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:76)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler.invoke(LocatingElementHandler.java:51)
    at com.sun.proxy.$Proxy26.click(Unknown Source)
    at com.sdl.cas.pageobjects.PropertiesPage.clickCancel(PropertiesPage.java:79)
    at com.sdl.cas.propertiesOperationsSysadmin.PropertiesOnSysadminTest.propertiesOnSysadmin(PropertiesOnSysadminTest.java:42)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at com.sdl.cas.config.ScreenShoot$1.evaluate(ScreenShoot.java:22)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

org.openqa.selenium.WebDriverException: 
Command duration or timeout: 135 milliseconds
Build info: version: '4.18.0', revision: 'b6bf9de7cc*'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [f24afa1c9266f3abd0d794077c9410df, quit {}]
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 125.0.6422.60, chrome: {chromedriverVersion: 125.0.6422.60 (3ac3319bff9f..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:34273}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), 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}
Session ID: f24afa1c9266f3abd0d794077c9410df

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:221)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:170)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:592)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:596)
    at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:434)

Operating System

RHEL8

Selenium version

Java 4.18.0

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

Chrome 123.0, 125.0.6422.142 (Official Build) (32-bit)

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

ChromeDriver 125

Are you using Selenium Grid?

Selenoid

github-actions[bot] commented 1 month ago

@cybertuck, 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 1 month ago

We need more information about this issue in order to troubleshoot.

Please turn on logging and re-run your code. Information on how to adjust logs for your language can be found in our Troubleshooting documentation.

titusfortner commented 1 month ago

This is likely a chromedriver issue, but it'll be easier to tell with better logs

joerg1985 commented 1 month ago

Sounds like this issue to me: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4596

@titusfortner Usually the users try to call driver.quit after a exception, so we could check the health of the driver process before executing the command (or all commands?) and raise a DriverTerminatedUnexpectedException to signal this is most likely not a selenium issue?

joerg1985 commented 1 month ago

PS: i had a short look at the code and there is some kind of logic to handle this, here: https://github.com/SeleniumHQ/selenium/blob/1b827c2b297988d4856bcee666f7b593fc8dc526/java/src/org/openqa/selenium/remote/service/DriverCommandExecutor.java#L121

But this code makes no sense to me, the process alive check does return a null response, this could explain the empty WebDriverException in the reported issue.

I will have a look at this in some days and at least fix the current implementation.

cybertuck commented 1 month ago

@joerg1985 You are right. My issue is similar to yours https://bugs.chromium.org/p/chromedriver/issues/detail?id=4596 When I run via Selenoid I`m getting "Command duration or timeout: 469 milliseconds" exception. I also was able to reproduce it locally with standalone selenium server and the exception is "ConnectException: Connection refused: no further information" @titusfortner If you want to reproduce joerg provided a test example in #4596 bugs.chromium

github-actions[bot] commented 1 month ago

Hi, @cybertuck. This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team. Feel free to comment the issues that you raise back in this issue. Thank you.

github-actions[bot] commented 3 days ago

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.