- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 launch Chrome Browser via Selenium?
We can launch Chrome browser via Selenium. Java JDK, Eclipse and Selenium webdriver should be installed in the system before Chrome browser is launch.
Follow the steps one by one to launch Chrome −
Navigate to the link: https://chromedriver.chromium.org/downloads.
Select the Chrome driver link which matches with the Chrome browser in our system.
Next, we have to choose and click on the Chrome driver link which is compatible with the operating system we are using.
A zip file gets downloaded. Extract and save the chromedriver.exe file in a location.
We can configure the chromedriver.exe file in the following ways −
By setting the System Properties in the Environment Variables. Go to the Start and type System and click on it. Select the Advanced System Settings. Then click on the Environment Variables from the Advanced. From the System Variables, select Path and click on Edit. Then click on New. Add the chromedriver.exe path and proceed.
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ChromeLaunch{ public static void main(String[] args) { WebDriver driver = new ChromeDriver(); String url = " https://www.tutorialspoint.com/questions/index.php"; driver.get(url); } }
By setting the System Properties in the script. By adding the browser type and chromedriver.exe path as parameters to the System.setProperty method in the code.
Example
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class LaunchChromeBrw{ public static void main(String[] args) { WebDriver driver = new ChromeDriver(); // browser type and chromedrover.exe path as parameters System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); String url = " https://www.tutorialspoint.com/questions/index.php"; driver.get(url); } }
- Related Articles
- Using the Selenium WebDriver - Unable to launch chrome browser on Mac
- How to launch Edge browser with Selenium Webdriver?
- How to run Selenium tests on Chrome Browser using?
- How to invoke the Chrome browser in Selenium with python?
- Running chrome browser in inconginto Mode in Selenium
- How to avoid the pop-up window in chrome browser with Selenium?
- How to take care of SSL certificate issues in chrome browser in Selenium?
- How to open a link in new tab of chrome browser using Selenium WebDriver?
- How do you launch the JavaScript debugger in Google Chrome?
- Is there any way to load an extension in chrome browser using Selenium Webdriver?
- How to Delete Bookmarks in your Browser (Firefox, Chrome)
- How to handle chrome notification in Selenium?
- How to open chrome default profile with selenium?
- Coolnovo a web browser similar to google chrome
- How to perform browser navigations in Selenium?
