1

The ISSUE:

The geckodriver.exe is not loading when I run with testNG. Firefox will launch, but selenium cannot connect to the browser and I get an error:

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. ....

My setup:

  • Windows 7
  • Eclipse Neon 3
  • Selenium 3.0.1
  • Geckodriver v0.13.0 (was using v0.11.1)
  • Firefox 48.0.2

First I created a quick test using Java and selenium. It just opens the browser and navigates to page. When this runs I see geckodriver process then the firefox process appear in the task manager.

Then I created a new project using Maven and testNG following the set-up from GURU99 web site. I have selenium and testNG added to the pom.xml file.

I used the convert project to testNG (xml file) and set the run configuration to run the XML file.

When I run the test I can see firefox process, then ff starts up. But the gecko driver process is never started.

Here is my code (excluding the imports):

public class NewTest {

    private WebDriver driver;

    @Test
    public void test01() {        
        driver.get("http://www.startpage.com");       
        System.out.println("Pge title " + driver.getTitle());                 
    }

    @BeforeTest
    public void beforeTest() {        
        System.setProperty("webdriver.gecko.driver", "c:\\selenium\\geckodriver.exe");        
        driver = new FirefoxDriver();
    }

    @AfterTest
    public void afterTest() {
        driver.quit();
    }   
}

1 Answer 1

1

You've missed to set the Marionette capability, e.g.

System.setProperty("webdriver.gecko.driver", <<Your driver path here>>);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability(FirefoxDriver.MARIONETTE, true);
cap.setCapability(FirefoxDriver.BINARY, <<Your firefox.exe path here>>);
cap.setCapability(FirefoxDriver.PROFILE, <<Your firefox profile here>>);
driver = new FirefoxDriver(cap);

I am using the above and it works like charm!

For more, see: Selenium 3 using Firefox Geckodriver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.