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 Marionnette driver.
I followed the instruction of this site to use this new driver with a RemotWebDriver but I keep having the error :
WARN - Exception: Exception in thread "main" org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/jgraham/wires. The latest version can be downloaded from ....
The code i've tried so far is very simple :
public class Test {
static WebDriver driver;
static Wait<WebDriver> wait;
public static void main(String[] args) throws MalformedURLException {
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
cap.setBrowserName("firefox");
driver = new RemoteWebDriver(new URL("http://192.168.117.135:5555/wd/hub"), cap);//true to enable the JS
wait = new WebDriverWait(driver, 3000);
final String url = "https://www.google.com/";
JavascriptExecutor js = (JavascriptExecutor) driver;
try {
driver.navigate().to(url);
} finally {
driver.close();
}
}
}
I'm sure that the path to the geckodriver.exe is right and i don't see where i did the mistake.
EDIT 1: I tried the following code :
public class Test {
static WebDriver driver;
static Wait<WebDriver> wait;
public static void main(String[] args) throws MalformedURLException {
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
driver = new MarionetteDriver();
wait = new WebDriverWait(driver, 3000);
final String url = "https://www.google.com/";
JavascriptExecutor js = (JavascriptExecutor) driver;
try {
driver.navigate().to(url);
} finally {
driver.close();
}
}
}
and it's working it seems that the problem come from the RemoteWebDriver and the gecko driver, any of you have news on it ?
Recently Selenium has launched Selenium 3 and if you are trying to use Firefox latest version then you have to use GeckoDriver:
System.setProperty("webdriver.gecko.driver","G:\\Selenium\\Firefox driver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();