

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the exact meaning of webdriver.chrome.driver and where this system property is located in Selenium?
To launch the Chrome browser, we have to use the System.setProperty method. This method takes the parameters – webdriver.chrome.driver and the path of the chromedriver.exe file.
So webdriver.chrome.driver is basically the property name and the path of the chromedriver.exe is the value. Thus, the System.setProperty method is used to configure the browser driver path.
The Selenium client library communicates with the ChromeDriver via the JSON Wire Protocol. The Chrome browser driver acts like a link between the Selenium implementation code and the Chrome browser. The System.setProperty is the beginning line that requires to be added to our test prior creation of webdriver initialization.
Syntax
System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe");
Example
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.Capabilities; import org.openqa.selenium.remote.RemoteWebDriver; public class ChromeBrwLaunch{ public static void main(String[] args) { //set chromedriver.exe file path System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get("https://www.tutorialspoint.com/index.htm"); // verify browser name and version with Capabilities class Capabilities cp = ((RemoteWebDriver) driver).getCapabilities(); System.out.println("Browser: " + cp.getBrowserName()); System.out.println("Version: " + cp.getVersion()); //browser close driver.quit(); } }
Output
- Related Questions & Answers
- Where is the world's biggest mobile factory located?
- Where is MySQL bin directory located in Windows OS?
- What is the meaning of supernatural power?
- What is the meaning of medical examination?
- What is the meaning of eCommerce store?
- What is the meaning of JavaScript void 0?
- What is the meaning of background app in Android?
- What is the meaning of the sacred Gayathri Mantra?
- What is the meaning of <> in MySQL query?
- What is the meaning of a Persistent Cookie in PHP?
- What is the meaning of immutable in term of String in java?
- What Is the Keep and Pay System?
- What is the meaning and usage of ‘=&’ assignment operator in PHP?
- Where do sunfish live? How big is this fish?
- What is the meaning of single underscore prefix with Python variables?
Advertisements