- 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 set Google Chrome in WebDriver?
We can set Google Chrome in Selenium. Java JDK, Eclipse and Selenium webdriver should be configured in the system before setting up the Chrome browser.
Steps to set Google Chrome are −
Navigate to the link: https://chromedriver.chromium.org/downloads.
Select the Chrome driver link which matches with the Chrome browser in the local system.
Then, we have to select 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.
import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ChromeSetup{ public static void main(String[] args) { WebDriver driver = new ChromeDriver(); driver.get("https://www.tutorialspoint.com/index.htm"); } }
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 SetChromeBrw{ 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"); driver.get("https://www.tutorialspoint.com/index.htm"); } }
- Related Articles
- How to Install Google Chrome in Ubuntu
- How to use Google Chrome Virus Scanner?
- How to disable Google Chrome autofill option?
- How to Maximize window in chrome using webDriver (Python)?
- How to run Selenium WebDriver test cases in Chrome?
- How to Clear the JavaScript Console in Google Chrome
- How to Block Pop-Ups on Google Chrome?
- How do I open Chrome in selenium WebDriver?
- How to mute all sounds in chrome webdriver with selenium?
- How to Automatically Generate Random Secure Passwords in Google Chrome?
- How to programmatically configure Chrome extension through Selenium WebDriver?
- How to use chrome webdriver in Selenium to download files in Python?
- How does Selenium Webdriver handle SSL certificate in Chrome?
- How to use Selenium webdriver to click google search?
- Running Selenium WebDriver python bindings in chrome.
