Time for action – starting Google Chrome or Chromium - Selenium

Imagine that you wanted to work with Google Chrome to get an attribute of an element on the page. To do this we will need to instantiate a ChromeDriver. Let's see an example.

  1. Update the setUp() method to load the ChromeDriver() :
    driver = new ChromeDriver();

  2. Now we need to find an element.In this section we will find the one with
    the ID s electLoad:
    WebElement element = driver.findElement(By.id("selectLoad"));

  3. Now we need to get the value attribute of that element:

  4. Run your test and it should look like the following:

What just happened?

We have just run a test with Google Chrome or with Chromium. It was fairly simple to get going and then the browser was able to get the value of the button. If you had trouble getting it to run, make sure that you have downloaded the ChromeDriver and added it to the environment variable called PATH.
Now that we have got ChromeDriver working, let's have a look at how we can update the browser as we did with Firefox.


Google Chrome or Chromium doesn't really have a profile that users can update in the same sense as Firefox.It does however have a mechanism that allows us to set certain options that Chrome will try and use. We can also tell it to install Chromium extensions, which are like Firefox add-ons, into the browser so we can enhance the experience.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics