Book Image

Learning Selenium Testing Tools - Third Edition

Book Image

Learning Selenium Testing Tools - Third Edition

Overview of this book

Table of Contents (22 chapters)
Learning Selenium Testing Tools Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with ChromeDriver


In this section, we will have a look at how we can start working with Google Chrome or with Chromium. Google Chrome or Chromium is in the top three browsers used in the world, so most people want to make sure that their web applications work with it.

Note

If you haven't downloaded ChromeDriver, you will need to do it now for the following sections. You will also need to set an environment path to where it is, so ChromeDriver in Java will know where to get it. This is purely for ChromeDriver. If you have Google Chrome or Chromium installed somewhere that isn't the default, we will see how to handle that with ChromeOptions.

On Linux and Mac OS X, export PATH=$PATH:/path/to/chromedriver.

On Windows, set PATH=$PATH;\path\to\chromedriver.

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 ChromeDriver. Let's see an example:

  1. Update the setUp() method to load ChromeDriver():

    driver = new ChromeDriver...