O'Reilly logo

Selenium 2 Testing Tools Beginner's Guide by David Burns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using ChromeOptions

Imagine that you needed to tell ChromeDriver the location of you Google Chrome or Chromium. To set this we will need to instantiate a ChromeOptions object and tell that where to find the Chrome/Chromium Binary.

Let's see how to do it:

  1. Update the setUp() method to instantiate a ChromeOptions object and call setBinary() method:
    ChromeOptions options = new ChromeOptions();
    options.setBinary("/path/to/location");
  2. Update the setUp() method to load the ChromeOptions object into the ChromeDriver:
    driver = new ChromeDriver(options);
  3. Now we need to find an element. In this section we will find the one with the ID selectLoad:
    WebElement element = driver.findElement(By.id("selectLoad"));
  4. Now we need to get the value attribute ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required