Selenium3
supports executable geckodriver
to launch Mozilla Firefox
just like other drivers; but executable geckodriver
is not compatible with Mozilla Firefox < v47
.
So How can we achieve backward compatibility with browsers V<47
i,e how can we use firefox
browsers V<47
with Selenium3
.
Disable the geckodriver
capabilities so that FirefoxDriver
can be used.
System.setProperty("webdriver.gecko.driver", "path/to/geckodriver.exe");
DesiredCapabilities d = new DesiredCapabilities();
d.setCapability("marionette", false); // to disable marionette, by default true
WebDriver driver = new FirefoxDriver(d);
Little Background to geckodriver.exe and Firefox version support:
From geckodriver
github page:
Firefox 47 is explicitly not supported
So, If you want to use <= Firefox 47
version, use Firefox driver
but not geckodriver
.
geckodriver
as selenium 2.53
uses Firefox driver
by default
). geckodriver
path (as geckodriver
is the default
driver for Firefox
in Selenium 3.0
) using System.setProperty
and set marionette
to false
, so geckodriver
capabilities will be disabled and default Firefox driver is used. References:
You should use old FirefoxDriver
, just make sure to set marionette on false if you are using RemoteDriver because I'm not sure is it enabled by default ( caps.setCapability(FirefoxDriver.MARIONETTE, false);
)
This driver doesn't need any .exe
file, just import org.openqa.selenium.firefox.FirefoxDriver;
in your code so you could use it.
driver = new FirefoxDriver();
or if you are using grid:
driver = RemoteWebDriver(url, DesiredCapabilities.firefox());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.