selenium: [๐ Bug]: org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: chromedriver, error Failed to parse json output
What happened?
I have Selenium Java tests failing on both Jenkins Pipeline and locally. An example of Dockerfile:
FROM maven:3.9.4-amazoncorretto-21-al2023
RUN yum update -y && \
yum install -y unzip xorg-x11-server-Xvfb gtk3-devel alsa-lib
WORKDIR /app
COPY . /app
RUN mvn clean verify
the test is nothing:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.*;
public class FailTest {
WebDriver driver;
@Test
public void testAsdf() {
ChromeOptions options = new ChromeOptions();
System.setProperty("SE_DEBUG", "true");
System.setProperty("SE_TRACE", "true");
options.addArguments("--headless=new");
driver = new ChromeDriver(options);
driver.get("http://www.google.com");
}
}
Using:
- Selenium 4.27.0
- TestNG 7.8.0
- Java 21
- Maven
How can we reproduce the issue?
docker build -t asdf .
Relevant log output
18.18 [INFO]
18.18 [INFO] -------------------------------------------------------
18.18 [INFO] T E S T S
18.18 [INFO] -------------------------------------------------------
18.32 [INFO] Running TestSuite
18.39 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
18.39 SLF4J: Defaulting to no-operation (NOP) logger implementation
18.40 SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
18.49 ...
18.49 ... TestNG 7.8.0 by Cรฉdric Beust (cedric@beust.com)
18.49 ...
18.49
58.71 [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 40.37 s <<< FAILURE! -- in TestSuite
58.71 [ERROR] tests.FailTest.testAsdf -- Time elapsed: 40.04 s <<< FAILURE!
58.71 org.openqa.selenium.remote.NoSuchDriverException:
58.71 Unable to obtain: chromedriver, error Failed to parse json output, executed: [--browser, chrome, --language-binding, java, --output, json]
58.71 rome/linux64/131.0.6778.85/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
58.71 },
58.71 {
58.71 "level": "TRACE",
58.71 "timestamp": 1732737672,
58.71 "message": "Copying /tmp/selenium-managerUAfrP9/WidevineCdm/manifest.json to /root/.cache/selenium/chrome/linux64/131.0.6778.85/WidevineCdm/manifest.json"
58.71 },
...
58.71 {
58.71 "level": "TRACE",
58.71 "timestamp": 1732737674,
58.71 "message": "URLs for CfT: [PlatformUrl { platform: \"linux64\", url: \"https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/linux64/chromedriver-linux64.zip\" }]"
58.71 },
...
58.71 {
58.71 "level": "INFO",
58.71 "timestamp": 1732737679,
58.71 "message": "Browser path: /root/.cache/selenium/chrome/linux64/131.0.6778.85/chrome"
58.71 }
58.71 ],
58.71 "result": {
58.71 "code": 0,
58.71 "message": "",
58.71 "driver_path": "/root/.cache/selenium/chromedriver/linux64/131.0.6778.85/chromedriver",
58.71 "browser_path": "/root/.cache/selenium/chrome/linux64/131.0.6778.85/chrome"
58.71 }
58.71 }
58.71 at org.openqa.selenium.remote.service.DriverFinder.getBinaryPaths(DriverFinder.java:121)
58.71 at org.openqa.selenium.remote.service.DriverFinder.getDriverPath(DriverFinder.java:55)
58.71 at org.openqa.selenium.chrome.ChromeDriver.generateExecutor(ChromeDriver.java:99)
58.71 at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
58.71 at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
58.71 at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
58.71 at tests.FailTest.testAsdf(FailTest.java:20)
58.71 at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
58.71 at java.base/java.lang.reflect.Method.invoke(Method.java:580)
58.71 at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
58.71 at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
58.71 at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
58.71 at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
58.71 at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
58.71 at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
58.71 at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
58.71 at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
58.71 at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
58.71 at org.testng.TestRunner.privateRun(TestRunner.java:848)
58.71 at org.testng.TestRunner.run(TestRunner.java:621)
58.71 at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
58.71 at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
58.71 at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
58.71 at org.testng.SuiteRunner.run(SuiteRunner.java:336)
58.71 at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
58.71 at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
58.71 at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
58.71 at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
58.71 at org.testng.TestNG.runSuites(TestNG.java:1114)
58.71 at org.testng.TestNG.run(TestNG.java:1082)
58.71 at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:308)
58.71 at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:71)
58.71 at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113)
58.71 at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
58.71 at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
58.71 at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
58.71 at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
58.71 Caused by: org.openqa.selenium.WebDriverException: Failed to parse json output, executed: [--browser, chrome, --language-binding, java, --output, json]
58.71 rome/linux64/131.0.6778.85/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
58.71 },
58.71 {
...
58.71 {
58.71 "level": "INFO",
58.71 "timestamp": 1732737679,
58.71 "message": "Browser path: /root/.cache/selenium/chrome/linux64/131.0.6778.85/chrome"
58.71 }
58.71 ],
58.71 "result": {
58.71 "code": 0,
58.71 "message": "",
58.71 "driver_path": "/root/.cache/selenium/chromedriver/linux64/131.0.6778.85/chromedriver",
58.71 "browser_path": "/root/.cache/selenium/chrome/linux64/131.0.6778.85/chrome"
58.71 }
58.71 }
58.71 at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:174)
58.71 at org.openqa.selenium.manager.SeleniumManager.getBinaryPaths(SeleniumManager.java:251)
58.71 at org.openqa.selenium.remote.service.DriverFinder.getBinaryPaths(DriverFinder.java:102)
58.71 ... 36 more
58.71 Caused by: org.openqa.selenium.json.JsonException: Unable to parse: rome/linux64/131.0.6778.85/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
58.71 },
...
58.74 {
58.74 "level": "TRACE",
58.74 "timestamp": 1732737674,
58.74 "message": "URLs for CfT: [PlatformUrl { platform: \"linux64\", url: \"https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/linux64/chromedriver-linux64.zip\" }]"
58.74 },
...
58.74 ],
58.74 "result": {
58.74 "code": 0,
58.74 "message": "",
58.74 "driver_path": "/root/.cache/selenium/chromedriver/linux64/131.0.6778.85/chromedriver",
58.74 "browser_path": "/root/.cache/selenium/chrome/linux64/131.0.6778.85/chrome"
58.74 }
58.74 }
58.74 [INFO]
58.74 [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
58.74 [INFO]
58.74 [INFO] ------------------------------------------------------------------------
58.74 [INFO] BUILD FAILURE
58.74 [INFO] ------------------------------------------------------------------------
58.74 [INFO] Total time: 57.648 s
58.74 [INFO] Finished at: 2024-11-27T20:01:19Z
58.74 [INFO] ------------------------------------------------------------------------
58.75 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.2:test (default-test) on project E2EProject: There are test failures.
58.75 [ERROR]
58.75 [ERROR] Please refer to /app/target/surefire-reports for the individual test results.
58.75 [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
58.75 [ERROR] -> [Help 1]
58.75 [ERROR]
58.75 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
58.75 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
58.75 [ERROR]
58.75 [ERROR] For more information about the errors and possible solutions, please read the following articles:
58.75 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
------
Dockerfile:9
--------------------
7 | COPY . /app
8 |
9 | >>> RUN mvn clean verify
--------------------
ERROR: failed to solve: process "/bin/sh -c mvn clean verify" did not complete successfully: exit code: 1
Operating System
Mac M1 PRO Sonoma 14.5
Selenium version
4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome latest
What are the browser driver(s) and version(s) where you see this issue?
Chromedriver latest
Are you using Selenium Grid?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (9 by maintainers)
Commits related to this issue
- [java] read complete output of selenium manager #14820 — committed to SeleniumHQ/selenium by joerg1985 2 years ago
This is arch ARM64/aarch64, I donโt think selenium-manager can download and launch the Google Chrome. When inspecting SM impl https://github.com/SeleniumHQ/selenium/blob/trunk/rust/src/chrome.rs, it will download the official Chrome binary only (
google-chrome). However,google-chromestill not support officially for Linux/ARM64 (that is the reason ofstandalone-chromiumdocker image was built). Moreover, assume that SM can configure/usr/bin/google-chrome, but it might trouble to launch the binary due to not support Arch.So, I am thinking that if above scenario is happing with the docker image
standalone-chrome(running on a host AMD64), then it would be an issue. Otherwise, it is recommended to useSE_OFFLINE=trueor use a pre-built browser/driver in the containerstandalone-chromium.I think it might be best to open a issue in the selenium-docker repo to have a look at this.