Run Selenium WebDriver Tests on Chrome Browser against MAC,LINUX,WINDOWS



Selenium automates browsers like Firefox,Chrome and Internet Explorer.
Selenium WebDriver Scripts run against multiple Platforms MAC,Windows and Linux.
In this tutorial, we will discuss about Running Selenium WebDriver Scripts on Chrome Browser.

Steps to be Followed to Execute Tests on Chrome Browser
1. Access the URL http://seleniumhq.org and navigate to the Downloads tab.

seleniumhq.org

seleniumhq.org


2. Click on the Download Link the Latest version of Selenium Jars.
Selenium Webdriver Latest Version

Selenium Webdriver Latest Version


3. Unzip the selenium-java-3.xx.0.zip file and view the contents of the Jar files.
Selenium WebDriver & Library Jar Files

Selenium WebDriver & Library Jar Files


4. Open Eclipse->Right Click on Java Project->Build Path->Configure Build Path.
ConfigureBuildPath

ConfigureBuildPath


5. Click on ‘External Jars’ button and navigate to the directory where the Selenium Webdriver jars are unzipped in previous Step 3.
AddExternalJars

AddExternalJars

6. Add the External Jar – client-combined-3.xx.0.jar.

client-combined-3.13.0.jar

client-combined-3.13.0.jar

7. Add the External Jars available under lib folder unzipped in Step 3.

Selenium WebDriver Lib Jars

Selenium WebDriver Lib Jars




Update Chrome Browser
1. On your computer, open Chrome browser.
2. At the top right, click More as shown in the below screenshot.

Chrome Browser - Update Chrome

Chrome Browser – Update Chrome


3. Click Update Google Chrome. If you don’t see this button, you’re on the latest version.
Chrome Latest - Version

Chrome Latest – Version


4. Click Relaunch and verify the Chrome Browser updated to the Latest version.




Download the chromedriver.exe and copy to Java Project.
1. Download the Latest Version of Chrome Driver Executable File from this link.
http://chromedriver.chromium.org/downloads
2. Download the Zip file according the Operating System-Windows,MAC,Linux.
Note: For Windows, 64 bit version is not available.

Chrome Latest Version-MAC,WINDOWS,LINUX

Chrome Latest Version-MAC,WINDOWS,LINUX


3. Unzip the File and look for chromedriver.exe.
Unzip the  file and look for chromedriver.exe

Unzip the file and look for chromedriver.exe


4. Right Click and copy the chromedriver.exe downloaded.
Copy chromedriver.exe

Copy chromedriver.exe


5. Open Eclipse and Right Click on the project in the package explorer and copy the Executable file in
the Java Project.
Selenium WebDriver PRoject

Selenium WebDriver PRoject


Example Program

Console Output

ConsoleOutput

ConsoleOutput



To disable the Information Logs in the console
Firefox:
Add the below statement before instantiating the Firefox Driver instance.
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,“null");
Chrome Browser
Add the below statements before instantiating driver instance.

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--log-level=3");
chromeOptions.addArguments("--silent");
WebDriver driver = new ChromeDriver(chromeOptions);

Leave a Reply

Your email address will not be published. Required fields are marked *