I\'m using Firefox 47.0 with Selenium 2.53. Recently they have been a bug between Selenium and Firefox which make code not working. One of the solution is to use the Marion
I create a simple Java application by archetype maven-archetype-quickstar, then revise pom.xml:
4.0.0
com.example
bar
0.0.1-SNAPSHOT
bar
bar
junit
junit
4.12
org.apache.maven.plugins
maven-resources-plugin
3.0.1
org.seleniumhq.selenium
selenium-java
3.0.0-beta3
org.seleniumhq.selenium
selenium-server
3.0.0-beta3
org.seleniumhq.selenium
selenium-api
3.0.0-beta3
org.seleniumhq.selenium
selenium-firefox-driver
3.0.0-beta3
bar
and
package bar;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class AppTest {
/**
* Web driver.
*/
private static WebDriver driver = null;
/**
* Entry point.
*
* @param args
* @throws InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
// Download "geckodriver.exe" from https://github.com/mozilla/geckodriver/releases
System.setProperty("webdriver.gecko.driver","F:\\geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://localhost:8080/foo/");
String sTitle = driver.getTitle();
System.out.println(sTitle);
}
}
You also use on Mac OS X, Linux: https://github.com/mozilla/geckodriver/releases
and
// On Mac OS X.
System.setProperty("webdriver.gecko.driver", "/Users/donhuvy/Downloads/geckodriver");