I have a selenium Java program that doesn’t work. It is a maven project with the following POM.
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.earl</groupId>
<artifactId>SampleProjectView3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>17</java.version>
<slf4j.version>2.0.7</slf4j.version>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</project>
The project has the folliowing class.
package pack1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FFExample {
public static void main(String[] args) {
System.out.println("Working Directory = " + System.getProperty("user.dir"));
WebDriver driver = new FirefoxDriver();
driver.get("https://www.youtube.com/@sreekanthnalagarla");
}
}
I am using the geckodriver from https://github.com/mozilla/geckodriver/releases/tag/v0.33.0. (I selected geckodriver-v0.33.0-macos-aarch64.tar.gz, because I am running on a MacBook Pro. I put the driver in the outermost project directory.
When I run the program, I get the following error.
Exception in thread "main" 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: 'Earls-MacBook-Pro.local', ip: 'fd68:f423:ee25:4154:10f2:c35d:6586:a4%en0'
…
(FFExample.java:10)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver process to start.
Build info: version: '4.10.0', revision: 'c14d967899'
System info: os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '13.4.1', java.version: '17.0.7'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:215)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:119)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)
... 9 more
The Browser never starts up.
I’m dead in the water. So, any help will be appreciated.