Exception in thread "main" java.lang.RuntimeException: Unable to find a free port
at org.openqa.selenium.net.PortProber.findFreePort(PortProber.java:67)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:351)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:190)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at basicweb.TestClass.main(TestClass.java:12)
I am on a Mac running macOS Mojave Version 10.14.3
I am running Eclipse Version: 2018-12 (4.10.0)
My Firefox is Firefox Quantum 65.(64-bit)
My geckodriver is v0.24.0
java version 11.0.2
Java Runtime Environment 18.9
I am just trying to run even the most basic code.
package basicweb;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestClass
{
public static void main(String[] args)
{
System.setProperty("webdriver.firefox.driver", "/Users/mdey/eclipse-workspace/SeleniumTutorial/Webdrivers/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
} I have tried with and without setting the driver location with setProperty.
I have tried running this code, just with the chrome driver, and I get the same error.
I have tried uninstalling java and re-installing java and JRE, uninstalling and re-installing eclipse, and I have tried several versions and combinations of Java, Firefox, and the webdriver.
I am not sure what else to do, and I am really hopeful someone can help me out! Thanks in advance for your support and all you do!
Check port range PortProber use to Random.