Verifying That the Development Environment Is Ready

Now that you have learned how to prepare browser drivers, it's time to verify that the development environment is ready to be used. The aim is to create an application that will verify that the development environment has been configured correctly. Before you begin, first ensure that you have successfully followed the steps in the sub-sections from previous sections. Also check whether the Chrome browser is installed on your computer.

The steps for completion of this process are as follows:

  1. Import WebDriver and ChromeDriver to BrowserCheck.java:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
  1. In the BrowserCheck class, enter the code to open and close the Chrome browser:
public static void main(String[] args) {
// Open and close the Chrome Browser
System.setProperty("webdriver.chrome.driver", "c:/
browserdrivers/chromedriver.exe");
WebDriver chrome = new ChromeDriver();
chrome.quit();
}
  1. Run the application by navigating to Run | Run… | BrowserCheck.

If everything is configured correctly, the application will open and close Chrome.

This is what your browser should look like:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.197.26