Using GeckoDriver

In this section, we will see how to configure and use Geckodriver for Firefox in our tests. First of all, we need to download the Geckodriver executable from https://github.com/mozilla/geckodriver/releases

Download the appropriate version of Geckodriver based on the Firefox version installed on your computer as well as the operating system. Copy the executable file into the /src/test/resources/drivers folder.

We will use the Search Test we created in Chapter 1 and modify the test to use the Geckodriver. For this, we need to modify the setup() method, provide the path of the Geckodriver binary in the webdriver.gecko.driver property, and instantiate the FirefoxDriver class:

public class SearchTest {    WebDriver driver;    @BeforeMethod ...

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.