This article provides a detailed guide where you will learn how to download the latest version of Selenium ChromeDriver. You will also see how you can setup Selenium ChromeDriver in multiple ways, and then write code which can launch Chrome browser using Selenium. Note: This article is a part of our Selenium Tutorial series. Please make sure that you have in order to avoid compatibility issues with Chrome.
What tool versions are we going to use for Selenium ChromeDriver setup? In this article, we will work with the latest and stable versions of Selenium, ChromeDriver and Google Chrome. The versions that we are going to use are –. Selenium – version 3.11.0. Chrome Browser – version 66. ChromeDriver – version 2.39 What is ChromeDriver?
To start any third party browser (Chrome, Opera etc.) Chrome browser on MAC using Selenium we have to use some drivers which will interact with the browsers. In windows, we have already seen working with IE, Chrome, Firefox and mobile browsers as well.
Before we begin, let us check out some basics of ChromeDriver. When you write test scripts in Selenium, you use WebDriver to launch and communicate with different browsers.
You will generally do this with the below line of code –. WebDriver driver = new FirefoxDriver ( ); Here, WebDriver is an open source tool for automated testing of webapps across many browsers. It provides capabilities for navigating to web pages, user input, JavaScript execution, and more. ChromeDriver simply helps WebDriver do this job on Chrome. In more technical words, ChromeDriver is a standalone server which implements WebDriver’s wire protocol for Chromium. Download Selenium ChromeDriver We would recommend you to download the latest version of ChromeDriver, mainly because it supports the latest versions of Chrome, and secondly it contains all the bug fixes. Let us see the steps that you can follow to download Selenium ChromeDriver – 1.
Open ChromeDriver download page – 2. This page contains all the versions of Selenium ChromeDriver. We are interested in the latest version of ChromeDriver, which is ChromeDriver 2.39 (as on 7th Jun 2018), as shown in the below image. Click on ChromeDriver 2.39 link. You will be navigated to ChromeDriver download page which contains ChromeDriver for Mac, Windows and Linux operating systems. Click on chromedriverwin32.zip to download ChromeDriver for Windows.
Once the zip file is downloaded, you can unzip it to retrieve chromedriver.exe This completes the Selenium ChromeDriver download process. Let us see how you can setup ChromeDriver in your project. As shown in the below image, this can be done in 2 different ways – If you have worked on Selenium automation before with some different browsers, then you would have realized that these 2 methods of setup are similar to what you do with other WebDriver variants.
If you use, InternetExplorerDriver, or SafariDriver for Mac, the process remains the same. Let us have a detailed look at each of these steps one by one.
Method 1: Use webdriver.chrome.driver system property With this method, you will have to add an additional line of code in your test case. Follow the steps given below to use this method – 1. Copy the entire path where you unzipped chromedriver.exe.
Let us assume that the location is – D: Drivers chromedriver.exe. You will need to add System.setProperty with the driver location to your code. Code to launch Chrome browser would look like this –.
Try it out and check if you are able to launch Chrome browser without the message. Let us now jump over to the next method of setting up ChromeDriver.
![Webdriver Webdriver](/uploads/1/2/5/4/125423885/102487002.jpg)
Method 2: Set property in Environment Variables With this approach, you will need to add ChromeDriver’s folder location to environment variables. The steps to follow this approach are given below – 1. Copy the entire folder location where chromedriver.exe is saved.
If the entire path is D: Drivers chromedriver.exe, then the folder location would be D: Drivers 2. You have to now open environment variables window in your machine. To do this, click on Start menu. Then right click on Computer and select Properties option 3. Now click on Advanced System Settings option 4.
This would open the System Properties window as shown below. Now from the Advanced Tab, click on Environment Variables button 5. Check that there is a variable named Path under System variables section as shown in below image 6. Select the Path variable and click on Edit button. Now move to the end of the Variable value field, then add a semi colon (;) and then ChromeDriver’s folder location (which in our case is – D: Drivers ) Note: Path variable contains multiple different values, and semi-colon acts as a separator between these multiple values. Click OK buttons to close all the windows. Since you have now set the driver path in Environment variables, so you don’t need to provide it in your code.
The new code to launch Chrome would look like this –. Run the code to see if it works fine. This completes our article on how to download latest ChromeDriver for Selenium and use it to launch Chrome browser. Try it out and let us know if this worked for you.
Feel free to contact us using comments section if you face any issue while implementing this. Bonus Tip: It’s a good approach to keep your browser maximized while running test scripts. And a good way to do this is to maximize the browser when you launch it for the first time. With Selenium ChromeDriver, you can do this using ChromeOptions class. The code snippet is given below –.
. Course latest updated on September 15, 2018 with Selenium WebDriver 3.11 version and Java interview questions. Most popular and most loved by students, best Selenium WebDriver course. includes: 270 lectures (Basics to Framework) with Real Time Websites. Life Time Access (Also best support you have ever received). No false promises, straight point to point explanation with simple and easy to understand examples.
Join the group of more than 20,000 students already taking advantage of this course with positive feedback. This course includes a wide range of topics from Selenium WebDriver Basics and Advanced, Java Concepts, TestNG Framework, Automation Framework Design ( Page Objects, Page Factory, Data Driven, Reading Excel Files), Logging with Log4j2, Best reporting tool - Advanced Reporting, Cross-Browser Testing with Selenium Grid 2.0, Maven Build Management, Continuous Integration with Jenkins, Git integration with Jenkins, Database Testing, Performance Testing, Behavior Driven Testing Using Cucumber, Sauce Labs Integration, Interview Preparation.
All materials including code files. One stop place to become an Expert in Web Automation Framework related technologies from scratch. We start from Beginners level and go through Advance level. This is a single course for everything you need to know related to Web UI Automation. WHAT MAKES THIS COURSE BEST IN CLASS. We assume that students have no experience in automation/coding and start every topic from scratch and basics.
Examples are taken from TESTING REAL TIME HOSTED WEB APPLICATIONS to understand how different components can be automated, that will give you idea of industry level framework and give you confidence. NO PRIOR CODING OR AUTOMATION EXPERIENCE NEEDED, this course covers all the necessary topics. Get more than 41 hours of unique content with real example code files provided to refer and learn with examples.
Get awesome Support, on demand desktop session on Team Viewer and Skype. W hat am I going to get from this course?. Over 270 lectures and 41 hours of content!