1
votes

I m using Selenium to fill in web forms .I added the libraryclient-combined 3.0.0 beta 3 to the document .My firefox version should be most updated . However , it comes out error .How to fix ? Or using webdriver as Chrome better?

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

public class Selenium {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {



WebDriver driver=new FirefoxDriver();

driver.get("https://mail.google.com");
driver.findElement(By.id("Email")).sendKeys("yourEmailId");
driver.findElement(By.id("Passwd")).sendKeys("yourPassword");
driver.findElement(By.id("signIn")).click();

}

}

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

1
As the error says you need to set the geckodriver with webdriver.gecko.driver; I suggest trying with chrome driver, see here how to start selenium stackoverflow.com/questions/39468600/… - lauda
Where should I implement the code java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.0.0-beta2.jar ? - evabb
run this in another console, this is how you start selenium server - lauda

1 Answers

0
votes

For Selenium 3.x with Firefox, use

System.setProperty("webdriver.gecko.driver", "path.to.geckodriver.exe");  
WebDriver driver = new FirefoxDriver();