Jul 16, 2019. Aug 22, 2018. Jun 06, 2018.
The PATH variable helps Chrome find the downloaded ChromeDriver exe. Donât get me wrong, Iâve updated PATH variables on Windows for years but never on a Mac, until now: System PATH Setup. The following instructions will help you create your own PATH to a unique folder on your Mac or copy the file to an existing PATH directory for ChromeDriver.
Posted by Praveen Mishra | April 28, 2020
Automation ⢠Selenium Testing ⢠Selenium Tutorial ⢠Chromedriver.exe Download For Macbook Pro
84556 Views | 11 Min Read
According to netmarketshare, Google Chrome accounts for 67% of the browser market share. It is the choice of the majority of users and itâs popularity continues to rise. This is why, as an automation tester, it is important that you perform automated browser testing on Chrome browser.
ChromeDriver is used along with Selenium to automate tests on the Chrome browser. Using Selenium ChromeDriver, you can communicate with Chrome browser to perform different operations like navigation from one web page to another web page, users can provide input on the web pages, javascript execution and many more operations.
In this article, I will show you how to use ChromeDriver to perform Selenium test automation. Iâll go into details about the ChromeDriver, starting from download, installation and to use it on Windows and Mac.
What Is ChromeDriver In Selenium?
To perform automated browser testing on Chrome browser, ChromeDriver class, a standalone executable, is used by Selenium WebDriver to create communication of our test script with the Chrome browsers. You can create a WebDriver object for Chrome like below:
Step 2: Now click on the Downloads tab on the top right side of the home page. So that we will get redirected to the download page.
Step 3: On the Downloads page, scroll down to the Browsers section as shown in below image.
Step 4: Expand Browsers section, here you can see links for different browsers. For Chrome browser, click on âDocumentationâ link under the âChromeâ section.
Step 5: Once you click on the documentation for Chrome browser from chrome section, we will be redirected to the page (https://sites.google.com/a/chromium.org/ChromeDriver/) from where you can download zip file for Automation testing with ChromeDriver.
In the above screenshot, you can see two options for ChromeDriver download. As ChromeDriver 78.0.3904.105 is the latest stable version available for the download, you should download that for better results..
While downloading the ChromeDriver, you need to make sure that it is compatible with the chrome browser version youâre using. Like ChromeDriver which I have downloaded, version 78.0.3904.105 will support all versions of Chrome browsers which start with 78.0.3904.
Step 6: Once you click on the latest stable version, it will open the following page which gives us an option to select the ChromeDriver to download for different operating systems like Linux, Mac and Windows.
Step 7: Download Selenium ChromeDriver for your operating system. For running tests on the Windows operating system, you can download ChromeDriver for Windows , just click on it and it will download the zip file of the ChromeDriver.
Once that zip file of ChromeDriver for Windows is downloaded, you can extract the ChromeDriver.exe file from that zip file.
Similarly, ChromeDriver for macOS can be downloaded. To install ChromeDriver on the macOS, we need to download it from the official website, we need to click and download ChromeDriver_mac64.zip file.
How To Use Selenium ChromeDriver On Windows?
Now that I have downloaded ChromeDriver and have installed other prerequisites applications as well in the system, Iâll use ChromeDriver and perform Selenium test automation scripts for the login test case on LambdaTest website.
For Windows, there are two different methods for Selenium test automation with ChromeDriver.
a) By using setProperty()
Using the setProperty() method from system class, Iâll provide the path of ChromeDriver from where the Selenium WebDriver can access it for Selenium test automation.
You can see the syntax for, how to set the location for the ChromeDriver.exe below:
So, letâs take a test scenario, login on LambdaTest platform using setProperty().
Steps for Test case:
While writing the Selenium test automation script, I have stored ChromeDriver.exe in the project folder itself. I can directly access it with âuser.dirâ and do not require to provide some other path. You can refer to the following screenshots for the location of ChromeDriver.
It is not mandatory to store ChromeDriver.exe in the project folder, you can store it in another folder or directory as well. In that case, you will have to provide correct path for the ChromeDriver.exe
You can find the test script for our test scenario below:
Upon executing the test script, it will open the browser and navigate to the home/landing page of LambdaTest website as shown in the screenshot below. While executing the test script, we can see the message âChrome is being controlled by the automated test softwareâ which means our test script is working with ChromeDriver.
Code Explanation:
Following screenshots show the result of the execution of the above test script.
b) By adding path in Environment Variable
In the above part I showed the execution of the Selenium test automation script using ChromeDriver, by providing a path of ChromeDriver in the test script itself.
There is another way as well, where I can set the path of ChromeDriver.exe in the system environment variable itself so that i donât need to set the path in selenium test automation script explicitly.
Let us see how you can set that path in the system environment variables.
So I have saved the path for Selenium ChromeDriver in system variables, now we will execute our Selenium test automation script. But we will not require to set the property ChromeDriver path in the test script explicitly.
So we have made changes accordingly in the script.
Following screenshot shows the result after execution of the above test script as it shows that our Selenium test automation script is successfully passed using Selenium ChromeDriver.
How To Use Selenium ChromeDriver on Mac OS?
Now, weâll perform test automation with Selenium ChromeDriver on Mac OS. After the zip file for Selenium ChromeDriver is downloaded, you can extract the application executable ChromeDriver file from it.
You can see the screenshot where downloaded and extracted executable ChromeDriver file from ChromeDriver zip file.
And I will store it in the eclipse project folder, so that I can use that in my selenium test automation script to invoke the chrome browser.
Now we can see how we will use that to invoke chrome browser and perform the same actions as we did in earlier cases.
As we have stored ChromeDriver in the project folder, it helped us to use it from there directly while invoking the browser.
Here, we have to notice that we just have to provide only the name ChromeDriver and not with its extension. Once the browser gets invoked and navigates to the LambdaTest home/landing page. It can be seen in the following screenshot.
We can also see the message âChrome is being controlled by automated test softwareâ, which shows that session is being controlled by Selenium ChromeDriver.
Following screenshots shows the successful execution of Selenium test automation script along with TestNG result.
Selenium ChromeDriver Using Maven Dependencies
So, in a practical scenario, while working in an organisation, you use some kind of build automation tools for test automation projects. Maven is a widely used build automation tool, ChromeDriver can be used with Maven dependencies as well.
Chromedriver.exe Download For Mac Windows 7
If you are not aware of maven please refer to our article on Selenium testing with Maven to start with.
While using maven, you need to change the approach. You no longer require to download ChromeDriver explicitly. In this case, you can just add a dependency for Automation testing with Selenium ChromeDriver in the pom.xml file.
And this dependency can be downloaded from the maven repository website https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver
Once you go to this website, click on the Selenium WebDriver version for which you want to download Selenium ChromeDriver dependency and then copy that dependency and paste it in the pom.xml file of your project.
Wrapping it Up
As Google Chromeâs popularity rises, so does the need to find automated browser testing of your web application on the Chrome browser. To perform Selenium test automation, you need a ChromeDriver to access the browser.
In this blog, weâve explored how you can download ChromeDriver in Selenium and run test scripts both on Windows and Mac OS. One with, setting property explicitly in test script by providing ChromeDriver path and another one with setting system environment variable.
Thatâs all for now! I hope you are more wiser, when it comes to automation testing with Selenium ChromeDriver. Do share your views and opinions with us in the comment section below. Also, feel free to retweet this article and help us reach out to your peers. Happy Testing!!! âº
Written by Praveen Mishra
Praveen is a Computer Science Engineer by degree, and a Digital Marketer by heart who works at LambdaTest. A social media maven, who is eager to learn & share about everything new & trendy in the tech domain.
2482 Views | 10 Min Min Read
8857 Views | 13 Min Min Read
22375 Views | 9 Min Min Read
16101 Views | 8 Min Min Read
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |