Using RemoteWebDriver for Firefox

Using the Firefox browser to execute our test scripts is similar to using the Chrome browser, except for a couple of variations in how GeckoDriver is launched.

Let's see this by changing the test script that we used for the Chrome browser to the following script, using "firefox":

@BeforeMethodpublic void setup() throws MalformedURLException {    DesiredCapabilities caps = new DesiredCapabilities();    caps.setBrowserName("firefox");    caps.setCapability("marionette", true);    driver = new RemoteWebDriver(new URL("http://10.172.10.1:4444/wd/hub"), caps);    driver.get("http://demo-store.seleniumacademy.com/");}

Before you try to execute this code, restart Selenium Standalone Server to use GeckoDriver:

java -jar -Dwebdriver.gecko.driver=geckodriver ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.