I am getting below error on running my testng test:
"org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Host info: host: 'xxxxx', ip: 'xxxxxxxxxxx' Build info: version: '4.15.0', revision: '1d14b5521b' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.5', java.version: '21.0.1' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [], binary: /Application"
Below are the details of versions I am using: Chrome browser version: 119 Webdrivermanager: 5.6.0 TestNg version: 7.8.0 Selenium-Java: 4.15.0 JDK: Tried 21, 18 and 11 but facing same issue every time
Here is the code I am trying to run:
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.*;
public class okta1 {
private WebDriver driver;
@BeforeClass
static void setupClass() {
WebDriverManager.chromedriver().clearDriverCache().setup();
}
@BeforeTest
void setupTest() {
ChromeOptions options = new ChromeOptions();
options.setCapability("browserVersion", "119.0.6045.105");
driver = new ChromeDriver(options);
}
@AfterTest
void teardown() {
driver.quit();
}
@Test
void test() {
// Exercise
driver.get("https://bonigarcia.dev/selenium-webdriver-java/");
String title = driver.getTitle();
// Verify
// assertThat(title).contains("Selenium WebDriver");
}
}
** Here is the pom.xml:**
<?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>org.example</groupId>
<artifactId>Teams-Automation-Framework</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</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.15.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>```
Tried changing different version of JDK and webdriver manager but still getting same error on every attempt