My project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>rs.a1.automation</groupId>
<artifactId>test-automation-framework</artifactId>
<version>2.9</version>
<properties>
<aspectj.version>1.9.22.1</aspectj.version>
<project.java.version>21</project.java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.24.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.24.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl/ -->
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.24.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.19.1</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-http-jdk-client -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>4.13.0</version>
</dependency>
<!-- <dependency> <!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-api –>-->
<!-- <groupId>org.seleniumhq.selenium</groupId>-->
<!-- <artifactId>selenium-api</artifactId>-->
<!-- <version>4.16.1</version>-->
<!-- </dependency>-->
<dependency> <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.17.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.9.2</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.testng/testng -->
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.3</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-maven -->
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.14.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.29.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-assertj -->
<groupId>io.qameta.allure</groupId>
<artifactId>allure-assertj</artifactId>
<version>2.29.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-attachments -->
<groupId>io.qameta.allure</groupId>
<artifactId>allure-attachments</artifactId>
<version>2.29.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-commandline -->
<groupId>io.qameta.allure</groupId>
<artifactId>allure-commandline</artifactId>
<version>2.30.0</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.3.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.8.1.jre11</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc11 -->
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>23.2.0.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${project.java.version}</source>
<target>${project.java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<mainClass>rs.a1.automation.test.RunTests</mainClass>
<arguments>
<argument>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>rs.a1.automation.test.RunTests</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.13.0</version>
<configuration>
<reportVersion>2.30.0</reportVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
My chrome version: 129.0.6668.59 (Official Build) (64-bit) (the problem occured on earlier versions too)
The error message I am getting for selenium-remote-driver versions 4.17.0 and later:
INFO Using chromedriver 129.0.6668.58 (resolved driver for Chrome 129)
INFO Exporting webdriver.chrome.driver as C:\Users\xxxxxxxx\.cache\selenium\chromedriver\win64\129.0.6668.58\chromedriver.exe
ERROR Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'xxxxxxxxxxxxx', ip: 'xxxxxxxxxxxxxx'
Build info: version: '4.19.1', revision: 'abe0ee07dc'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.4'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], extensions: [Q3IyNAMAAAAZBAAAEqwECqYCMII...]}}]}]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:537)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:233)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:162)
at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:89)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:84)
at rs.a1.automation.core.WebDriverActions.startChromeDriver(WebDriverActions.java:82)
at rs.a1.automation.core.WebDriverActions.createDriver(WebDriverActions.java:61)
at rs.a1.automation.core.WebDriverActions.createDriver(WebDriverActions.java:36)
at rs.a1.automation.scenarios.ChangeTariff.setUp(ChangeTariff.java:33)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)
at org.testng.internal.invokers.TestInvoker.runConfigMethods(TestInvoker.java:833)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:600)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:230)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:63)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:992)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:203)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:154)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:134)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at org.testng.TestRunner.privateRun(TestRunner.java:739)
at org.testng.TestRunner.run(TestRunner.java:614)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:421)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:413)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:373)
at org.testng.SuiteRunner.run(SuiteRunner.java:312)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
at org.testng.TestNG.runSuites(TestNG.java:1112)
at org.testng.TestNG.run(TestNG.java:1079)
at rs.a1.automation.core.TestNGXmlBuilder.runTestNGXml(TestNGXmlBuilder.java:114)
at rs.a1.automation.test.RunTests.main(RunTests.java:13)
Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/HttpHeader
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:110)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:95)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:67)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:162)
at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:519)
... 38 more
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.http.HttpHeader
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
... 45 more
The only change I do to reproduce this issue is to change from 4.16.1 to 4.17.0 in my pom
Method where I instantiate chromedriver:
private void startChromeDriver() {
//using Java 11 HTTP client, avoiding the Netty library which uses the now obsolete AsyncHttpClient
System.setProperty("webdriver.http.factory", "jdk-http-client");
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File(".\\src\\test\\resources\\pdfviewer.crx"));
driver = new ChromeDriver(options);
browserCapabilities = ((RemoteWebDriver) driver).getCapabilities();
javascriptExecutor = (JavascriptExecutor) driver;
}
I have searched the internet far and wide, reviewed selenium change logs and commits, but was not able to find the solution...
After an extensive search, I found this issue which contained comments that fixed my issue, leaving it here if anyone in the future encounters a similar problem :)