0

Windows 10 - 32 bit

Selenium Version:

3.0.0 beta 3 Browser:

Firefox 48.02 Eclipse Luna 32 bit

 package newpackage;

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;

    public class MyClass {
    public static void main(String[] args) {
    // declaration and instantiation of objects/variables
           System.setProperty "webdriver.firefox.marionette","D:\\Selenium\\geckodriver.exe");
      //System.setProperty("webdriver.gecko.driver","D:\\Selenium\\geckodriver.exe");


      WebDriver driver = new FirefoxDriver();


    String baseUrl = "http://newtours.demoaut.com";
    String expectedTitle = "Welcome: Mercury Tours";
    String actualTitle = "";

    // launch Firefox and direct it to the Base URL
    driver.get(baseUrl);

    // get the actual value of the title
    actualTitle = driver.getTitle();

    /*
     * compare the actual title of the page witht the expected one and print
     * the result as "Passed" or "Failed"
     */
    if (actualTitle.contentEquals(expectedTitle)){
        System.out.println("Test Passed!");
    } else {
        System.out.println("Test Failed");
    }

    //close Firefox
    driver.close();

    // exit the program explicitly
    System.exit(0);
}


}

Error:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: les":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"1.5","maxVersion":"9.9"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":0,"seen":true}

imBollaveni
  • 99
  • 1
  • 13
jagpreet
  • 1
  • 3
  • looks like your selenium and firefox version are not compatible to each other. Try to switch to an older version of firefox or downgrade your selenium version to a stable version (v2.52.0) – metar Sep 12 '16 at 09:33
  • Why are you commented this line `System.setProperty("webdriver.gecko.driver","D:\\Selenium\\geckodriver.exe");`? – Saurabh Gaur Sep 12 '16 at 09:48
  • Have a look [at this link](http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium/38676858#38676858) to launch firefox using geckodriver.. – Saurabh Gaur Sep 12 '16 at 09:50

1 Answers1

0

This kind of issues are coming in selenium 3.0 beta version.

If you are using using Selenium Standalone jar then you have to pass marionette as capabilities and initialize FirefoxDriver as follows:

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capabilities);

Tried with geckodriver v 0.10.0.

String driverPath = "<path to gecko driver executable>";
public WebDriver driver;
public void launchBrowser() {
        System.out.println("launching firefox browser"); 
        System.setProperty("webdriver.gecko.driver", driverPath+"geckodriver.exe");
        driver = new FirefoxDriver();
    }