Closed vikaskrsharma closed 7 months ago
@vikaskrsharma, thank you for creating this issue. We will troubleshoot it as soon as we can.
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!
@vikaskrsharma - Can you please share your build file (pom.xml
(or) build.gradle
|build.gradle.kts
) so that we know what your dependencies look like
@krmahadevan Here is the dependencies snippet in pom file:
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>BuyerWeb</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.17.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>4.13.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.3</version>
</dependency>
<dependency>
<groupId>com.github.mwiede</groupId>
<artifactId>jsch</artifactId>
<version>0.2.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.9.0</version>
<!-- <scope>test</scope>-->
</dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
</dependencies>
@vikaskrsharma - Can you please share your build file (
pom.xml
(or)build.gradle
|build.gradle.kts
) so that we know what your dependencies look like
I have shared the pom file dependencies. Also fyi, if i just update selenium java version to 4.16.1, it working fine but 4.16.1 does not support devtools cdp for chrome 121 so updating it to 4.17.0 which is giving above issue
@vikaskrsharma - Can you please retry after removing the below dependencies ?
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>4.13.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.3</version>
</dependency>
By default selenium would use the jdk provided httpclient and so you don't need to bring it in explicitly. Selenium also has the capabilities to manage the driver binaries and so you don't need webdrivermanager. You can read more about this aspect in the official documentation here
I retried using the below example
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.time.Duration;
public class AppTest {
private ChromeDriver driver;
public void initializeDriver() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--remote-allow-origins=*");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
driver.manage().window().maximize();
}
@BeforeMethod
public void launchApp() {
initializeDriver();
}
@Test
public void testMethod() {
String url = "https://selenium.dev";
System.out.println("Before get: " + url);
driver.get(url);
System.out.println("After get: " + url);
}
@AfterMethod
public void teardown() {
driver.close();
}
}
@krmahadevan Thank you very much for the much needed help. It is working fine. Also for future Reference, if there is already a chromedriver binary present in /usr/local/bin folder for older chrome version, then have to delete it manually as selenium will be using that binary which will be not be compatible with latest version.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
What happened?
I have a selenium test which is working fine till version v4.16.1 and is working fine with latest chrome version. but as soon as i update the selenium version to 4.17, Chrome is not getting launched and getting error SessionNotCreatedException with cause: Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/HttpHeader. I also have to use chrome v4.17 as devtools protocol api support for chrome v121 is only available in v4.17.
Here is my browser initialization code:
How can we reproduce the issue?
Relevant log output
Operating System
macOs Sonoma
Selenium version
Java 4.17.0
What are the browser(s) and version(s) where you see this issue?
Chrome 121
What are the browser driver(s) and version(s) where you see this issue?
Latest ChromeDriver
Are you using Selenium Grid?
No response