3

I have just started learning Selenium Java . I am running my script with Selenium Beta 3 and Mozilla Firefox v43. Here is my code`

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class RegistrationFirefox {

    public static void main(String[] args) 
    {
        System.setProperty("webdriver.gecko.driver", "C:\\SeleniumDrivers\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();

        driver.get("http://www.google.com");
        System.out.println(driver.getTitle());
        driver.manage().window().maximize();    
        driver.close();
    }    
}

Initially I was getting the error regarding

"Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver

After installing the geckodriver this is the error I am getting (code mentioned above)

Exception in thread "main" org.openqa.selenium.WebDriverException: Unsupported Marionette protocol version 2, required 3 (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 5.26 seconds

1 Answer 1

4

"Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver

Actually Selenium 3 supports to work with Mozilla Firefox using geckodriver executable just like other driver support. That's why you're getting this exception.

To resolve this issue you need to set this executable geckodriver into system property with webdriver.gecko.driver which you have already done.

Exception in thread "main" org.openqa.selenium.WebDriverException: Unsupported Marionette protocol version 2, required 3 (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 5.26 seconds

Now the problem is your Mozilla version. Actually executable geckodriver supports Mozilla Firefox >= v47 that's why you're getting this exception.

To resolve this issue you need to upgrade your Mozilla Firefox >= v47 as well.

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.