Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown HttpClient factory netty when create remote webdriver #9173

Closed
yuandanxu opened this issue Feb 14, 2021 · 9 comments
Closed

Unknown HttpClient factory netty when create remote webdriver #9173

yuandanxu opened this issue Feb 14, 2021 · 9 comments

Comments

@yuandanxu
Copy link

yuandanxu commented Feb 14, 2021

🐛 Bug Report

Get "Unknown HttpClient factory netty" when create remote web driver using latest selenium version 4.0.0-alpha-7.

To Reproduce

Here's the pom I used:

        <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>Selenium4</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.2</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.3.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.18</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
            <version>2.4.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.14.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.14.0</version>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>4.3.1</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>
</project>

Error log:
java.lang.ExceptionInInitializerError
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:157)
at com.kt.drivers.ChromeWebDriverServiceImpl.create(ChromeWebDriverServiceImpl.java:67)
at com.kt.cases.BaseTest.beforeMethod(BaseTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:61)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:366)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:320)
at org.testng.internal.TestInvoker.runConfigMethods(TestInvoker.java:701)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:527)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at org.testng.TestRunner.privateRun(TestRunner.java:764)
at org.testng.TestRunner.run(TestRunner.java:585)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
at org.testng.SuiteRunner.run(SuiteRunner.java:286)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.runSuites(TestNG.java:1069)
at org.testng.TestNG.run(TestNG.java:1037)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Caused by: java.lang.IllegalArgumentException: Unknown HttpClient factory netty
at org.openqa.selenium.remote.http.HttpClient$Factory.create(HttpClient.java:54)
at org.openqa.selenium.remote.http.HttpClient$Factory.createDefault(HttpClient.java:70)
at org.openqa.selenium.remote.HttpCommandExecutor.(HttpCommandExecutor.java:47)
... 36 more

Detailed steps to reproduce the behavior:

Expected behavior

Web driver can be created successfully.

Test script or set of commands reproducing this issue

Source codes to create web driver, and the same codes work for selenium 3.

   public WebDriver create(String testName) {
        logger.debug("create() - create chrome web driver");
        final ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.addArguments("--no-sandbox");
        chromeOptions.addArguments("disable-infobars");
        chromeOptions.addArguments("--ignore-certificate-errors");
        chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE);
        chromeOptions.setCapability("screenResolution", "1920x1080");
        chromeOptions.setCapability(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
        chromeOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        final Map<String, Object> prefs = new HashMap<>();
        prefs.put("credentials_enable_service", false);
        prefs.put("profile.password_manager_enabled", false);
        prefs.put("profile.default_content_settings.popups", 0);
        prefs.put("download_prompt_for_download", false);
        chromeOptions.setExperimentalOption("prefs", prefs);
        final LoggingPreferences loggingPreferences = new LoggingPreferences();
        loggingPreferences.enable(LogType.BROWSER, Level.WARNING);
        chromeOptions.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences);
        chromeOptions.setCapability("name", testName);
        chromeOptions.setCapability("tz", "America/Montreal");
        logger.info("create() - hub url is {}", hubUrl);
        final RemoteWebDriver remoteWebDriver = new RemoteWebDriver(hubUrl, chromeOptions);
        logger.debug("create() - remote web driver session with id {} created", remoteWebDriver.getSessionId());
        remoteWebDriver.manage().window().maximize();
        return remoteWebDriver;
    }

Environment

OS: IOS
Browser: Chrome
Browser version:
Browser Driver version: ChromeDriver 88.0.4324.96
Language Bindings version:
Selenium Grid version (if applicable):

@barancev
Copy link
Member

Run mvn depndency:tree and watch the output, you must be having multiple different versions of selenium artifacts in the classpath. I suppose webdrivermanager brings an unwanted selenium version as a transitive dependency.

@yuandanxu
Copy link
Author

Thanks @barancev for your comments. I ran it, and didn't see any selenium in webdrivermanager. Here's the output:

[INFO] org.example:Selenium4:jar:1.0-SNAPSHOT
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-api:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.141.59:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.10.19:compile
[INFO] |  |  +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] |  |  +- com.google.guava:guava:jar:25.0-jre:compile
[INFO] |  |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  |  |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] |  |  +- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] |  |  \- com.squareup.okio:okio:jar:1.14.0:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v84:jar:4.0.0-alpha-7:compile
[INFO] |  |  +- com.google.auto.service:auto-service-annotations:jar:1.0-rc7:compile
[INFO] |  |  +- com.google.auto.service:auto-service:jar:1.0-rc7:compile
[INFO] |  |  |  \- com.google.auto:auto-common:jar:0.10:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-devtools:jar:4.0.0-alpha-7:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-http:jar:4.0.0-alpha-7:compile
[INFO] |  |  \- org.seleniumhq.selenium:selenium-json:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v86:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v87:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-edgehtml-driver:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-firefox-xpi-driver:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.141.59:compile
[INFO] |  \- org.seleniumhq.selenium:selenium-support:jar:3.141.59:compile
[INFO] +- org.testng:testng:jar:7.3.0:compile
[INFO] |  +- com.beust:jcommander:jar:1.78:compile
[INFO] |  +- org.apache.ant:ant:jar:1.10.3:compile
[INFO] |  |  \- org.apache.ant:ant-launcher:jar:1.10.3:compile
[INFO] |  +- junit:junit:jar:4.13.1:compile
[INFO] |  |  \- org.hamcrest:hamcrest-core:jar:2.2:compile
[INFO] |  +- com.google.inject:guice:jar:no_aop:4.2.2:compile
[INFO] |  |  +- javax.inject:javax.inject:jar:1:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.27:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.18:provided
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.4.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.4.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.4.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.4.2:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  |  \- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.4.2:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.4:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.4.2:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.41:compile
[INFO] |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.41:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.3:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.3:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.3.3:compile
[INFO] |     +- org.springframework:spring-aop:jar:5.3.3:compile
[INFO] |     +- org.springframework:spring-context:jar:5.3.3:compile
[INFO] |     \- org.springframework:spring-expression:jar:5.3.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.4.2:compile
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.4.2:compile
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] |  +- org.assertj:assertj-core:jar:3.18.1:compile
[INFO] |  +- org.hamcrest:hamcrest:jar:2.2:compile
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.7.0:compile
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.0:compile
[INFO] |  |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:compile
[INFO] |  |  |  +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] |  |  |  \- org.junit.platform:junit-platform-commons:jar:1.7.0:compile
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.7.0:compile
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.0:runtime
[INFO] |  |     \- org.junit.platform:junit-platform-engine:jar:1.7.0:runtime
[INFO] |  +- org.mockito:mockito-core:jar:3.6.28:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.19:compile
[INFO] |  |  \- org.objenesis:objenesis:jar:3.1:compile
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:3.6.28:compile
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:compile
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile
[INFO] |  +- org.springframework:spring-core:jar:5.3.3:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.3.3:compile
[INFO] |  +- org.springframework:spring-test:jar:5.3.3:compile
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.7.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.4.0:compile
[INFO] |  +- org.glassfish:jakarta.el:jar:3.0.3:compile
[INFO] |  \- org.hibernate.validator:hibernate-validator:jar:6.1.7.Final:compile
[INFO] |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.14.0:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.14.0:compile
[INFO] \- io.github.bonigarcia:webdrivermanager:jar:4.3.1:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]    +- commons-io:commons-io:jar:2.8.0:compile
[INFO]    +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO]    +- org.apache.commons:commons-lang3:jar:3.11:compile
[INFO]    +- org.apache.httpcomponents.client5:httpclient5:jar:5.0.3:compile
[INFO]    |  +- org.apache.httpcomponents.core5:httpcore5:jar:5.0.2:compile
[INFO]    |  +- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.0.2:compile
[INFO]    |  \- commons-codec:commons-codec:jar:1.15:compile
[INFO]    +- org.rauschig:jarchivelib:jar:1.1.0:compile
[INFO]    |  \- org.apache.commons:commons-compress:jar:1.20:compile
[INFO]    \- org.jsoup:jsoup:jar:1.13.1:compile

@yuandanxu
Copy link
Author

yuandanxu commented Feb 15, 2021

I removed webdriver manager, and still got the same error. I noticed that the dependency of 4 includes version of 3.*, is this expected?

[INFO] +- org.seleniumhq.selenium:selenium-java:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-api:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:3.141.59:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.10.19:compile
[INFO] |  |  +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO] |  |  +- com.google.guava:guava:jar:25.0-jre:compile
[INFO] |  |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  |  |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] |  |  |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] |  |  +- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] |  |  \- com.squareup.okio:okio:jar:1.14.0:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v84:jar:4.0.0-alpha-7:compile
[INFO] |  |  +- com.google.auto.service:auto-service-annotations:jar:1.0-rc7:compile
[INFO] |  |  +- com.google.auto.service:auto-service:jar:1.0-rc7:compile
[INFO] |  |  |  \- com.google.auto:auto-common:jar:0.10:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-devtools:jar:4.0.0-alpha-7:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-http:jar:4.0.0-alpha-7:compile
[INFO] |  |  \- org.seleniumhq.selenium:selenium-json:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v86:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-devtools-v87:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-edge-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-edgehtml-driver:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-firefox-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-firefox-xpi-driver:jar:4.0.0-alpha-7:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-ie-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-opera-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.141.59:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-safari-driver:jar:3.141.59:compile
[INFO] |  \- org.seleniumhq.selenium:selenium-support:jar:3.141.59:compile

@yuandanxu
Copy link
Author

It worked when use individual dependencies instead of the java one.

<dependencies>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-api</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-chrome-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-support -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-support</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-firefox-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-ie-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-ie-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-safari-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-safari-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-edge-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-edge-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-opera-driver -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-opera-driver</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>

@barancev
Copy link
Member

Not sure what's going on in your system, I've created this simple POM file

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>Selenium4</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.0.0-alpha-7</version>
        </dependency>
    </dependencies>
</project>

and the result of mvn dependency:tree is

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ Selenium4 ---
[INFO] org.example:Selenium4:jar:1.0-SNAPSHOT
[INFO] \- org.seleniumhq.selenium:selenium-java:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-api:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-chrome-driver:jar:4.0.0-alpha-7:compile
[INFO]    |  +- com.google.auto.service:auto-service-annotations:jar:1.0-rc7:compile
[INFO]    |  +- com.google.auto.service:auto-service:jar:1.0-rc7:compile
[INFO]    |  |  \- com.google.auto:auto-common:jar:0.10:compile
[INFO]    |  +- com.google.guava:guava:jar:30.0-jre:compile
[INFO]    |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO]    |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO]    |  |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO]    |  |  +- org.checkerframework:checker-qual:jar:3.5.0:compile
[INFO]    |  |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO]    |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO]    |  +- org.seleniumhq.selenium:selenium-chromium-driver:jar:4.0.0-alpha-7:compile
[INFO]    |  +- org.seleniumhq.selenium:selenium-devtools:jar:4.0.0-alpha-7:compile
[INFO]    |  +- org.seleniumhq.selenium:selenium-http:jar:4.0.0-alpha-7:compile
[INFO]    |  \- org.seleniumhq.selenium:selenium-json:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v84:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v85:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v86:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-devtools-v87:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-edge-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-edgehtml-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-firefox-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-firefox-xpi-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-ie-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-opera-driver:jar:4.0.0-alpha-7:compile
[INFO]    +- org.seleniumhq.selenium:selenium-remote-driver:jar:4.0.0-alpha-7:compile
[INFO]    |  +- com.typesafe.netty:netty-reactive-streams:jar:2.0.4:compile
[INFO]    |  |  +- io.netty:netty-handler:jar:4.1.43.Final:compile
[INFO]    |  |  \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO]    |  +- io.grpc:grpc-context:jar:1.32.1:compile
[INFO]    |  +- io.netty:netty-buffer:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-codec-http:jar:4.1.53.Final:compile
[INFO]    |  |  \- io.netty:netty-codec:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-common:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-epoll:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-kqueue:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport-native-unix-common:jar:4.1.53.Final:compile
[INFO]    |  +- io.netty:netty-transport:jar:4.1.53.Final:compile
[INFO]    |  |  \- io.netty:netty-resolver:jar:4.1.53.Final:compile
[INFO]    |  +- io.opentelemetry:opentelemetry-api:jar:0.9.1:compile
[INFO]    |  +- io.opentelemetry:opentelemetry-context-prop:jar:0.9.1:compile
[INFO]    |  +- io.opentelemetry:opentelemetry-sdk:jar:0.9.1:compile
[INFO]    |  |  +- io.opentelemetry:opentelemetry-sdk-common:jar:0.9.1:compile
[INFO]    |  |  +- io.opentelemetry:opentelemetry-sdk-baggage:jar:0.9.1:compile
[INFO]    |  |  +- io.opentelemetry:opentelemetry-sdk-metrics:jar:0.9.1:compile
[INFO]    |  |  \- io.opentelemetry:opentelemetry-sdk-tracing:jar:0.9.1:compile
[INFO]    |  +- io.projectreactor.netty:reactor-netty-http:jar:1.0.0:compile
[INFO]    |  |  +- io.netty:netty-codec-http2:jar:4.1.53.Final:compile
[INFO]    |  |  +- io.netty:netty-resolver-dns:jar:4.1.53.Final:compile
[INFO]    |  |  |  \- io.netty:netty-codec-dns:jar:4.1.53.Final:compile
[INFO]    |  |  \- io.projectreactor.netty:reactor-netty-core:jar:1.0.0:compile
[INFO]    |  +- io.projectreactor.netty:reactor-netty:jar:1.0.0:compile
[INFO]    |  |  \- io.projectreactor.netty:reactor-netty-http-brave:jar:1.0.0:runtime
[INFO]    |  |     \- io.zipkin.brave:brave-instrumentation-http:jar:5.12.7:runtime
[INFO]    |  |        \- io.zipkin.brave:brave:jar:5.12.7:runtime
[INFO]    |  |           \- io.zipkin.reporter2:zipkin-reporter-brave:jar:2.15.2:runtime
[INFO]    |  |              +- io.zipkin.reporter2:zipkin-reporter:jar:2.15.2:runtime
[INFO]    |  |              \- io.zipkin.zipkin2:zipkin:jar:2.21.7:runtime
[INFO]    |  +- io.projectreactor:reactor-core:jar:3.4.0:compile
[INFO]    |  +- net.bytebuddy:byte-buddy:jar:1.10.18:compile
[INFO]    |  +- org.apache.commons:commons-exec:jar:1.3:compile
[INFO]    |  \- org.asynchttpclient:async-http-client:jar:2.12.1:compile
[INFO]    |     +- org.asynchttpclient:async-http-client-netty-utils:jar:2.12.1:compile
[INFO]    |     +- io.netty:netty-codec-socks:jar:4.1.48.Final:compile
[INFO]    |     +- io.netty:netty-handler-proxy:jar:4.1.48.Final:compile
[INFO]    |     +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO]    |     \- com.sun.activation:javax.activation:jar:1.2.0:compile
[INFO]    +- org.seleniumhq.selenium:selenium-safari-driver:jar:4.0.0-alpha-7:compile
[INFO]    \- org.seleniumhq.selenium:selenium-support:jar:4.0.0-alpha-7:compile
[INFO] ------------------------------------------------------------------------```

@barancev
Copy link
Member

barancev commented Feb 16, 2021

Also please note that 4.0.0-beta-1 has beed released, it's recommended to upgrade to this version.

@yuandanxu
Copy link
Author

Thanks @barancev . I updated to beta-1, still the same issue. So weird. Thanks for all the help.

@jddipqd
Copy link

jddipqd commented Jun 4, 2021

The issue you're having is because of Spring.
Spring manages version of dependencies in it's parent pom.
When you do

<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.0.0-alpha-7</version>
</dependency>

You have overridden only the selenium-java artifact, but Spring continues to manages the transitive dependencies.
This is why it works if you manually add each dependency (they're not transitive anymore and you override each).

The proper way to override would be to do:

<properties>
	<selenium.version>4.0.0-alpha-7</selenium.version>
</properties>

And the use it without version>

<dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
</dependency>

@zhq5101
Copy link

zhq5101 commented Jun 19, 2021

@jddipqd It works! Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants