- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to run Selenium tests on Chrome Browser using?
We can run Selenium tests on Chrome browser with the help of the chromedriver.exe executable file. First, we have to download the chromedriver.exe file from the following link − https://sites.google.com/a/chromium.org/chromedriver/downloads
We have to click on the link which matches with the Chrome browser in our system. Next, choose the link based operating system (Windows, Linux or Mac) we are presently using.
Once the download has completed, a zip file gets created. We have to extract the zip file and store the chromedriver.exe file in a desired location. Then, we have to configure the path of the chromedriver.exe file using the System.setProperty method along with creating an object of the ChromeDriver class.
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.Capabilities; import org.openqa.selenium.remote.RemoteWebDriver; public class ChromeBrwLaunch{ public static void main(String[] args) { //configure chromedriver.exe path System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); //object of ChromeDriver WebDriver driver = new ChromeDriver(); //launch URL driver.get("https://www.tutorialspoint.com/index.htm"); // get browser name Capabilities cap = ((RemoteWebDriver) driver).getCapabilities(); System.out.println("Browser: " + cap.getBrowserName()); driver.close(); } }
Output
- Related Articles
- How to run Selenium tests on Internet Explorer browser?
- Using the Selenium WebDriver - Unable to launch chrome browser on Mac
- How to launch Chrome Browser via Selenium?
- How to run Selenium WebDriver test cases in Chrome?
- How to invoke the Chrome browser in Selenium with python?
- How to save as PDF on Chrome using Selenium
- How to open a link in new tab of chrome browser using Selenium WebDriver?
- Running chrome browser in inconginto Mode in Selenium
- How to avoid the pop-up window in chrome browser with Selenium?
- Is there any way to load an extension in chrome browser using Selenium Webdriver?
- How to take care of SSL certificate issues in chrome browser in Selenium?
- How to run Selenium tests in multiple browsers one after another from C# NUnit?
- How to run tests using a test runner file for Cucumber?
- How to setup Chrome driver with Selenium on MacOS?
- How to switch different browser tabs using Python Selenium?

Advertisements