Subscribe Us

How To Launch Chrome Browser in Selenium Webdriver

.
Question : How To Launch Chrome Browser in Selenium Webdriver ?

Answer :
Step-1 :To launch chrome browser in selenium we have to download the chrome driver first from the official website of selenium Click here to download.(Download 32 bit or 64 bit as your Pc configuration)
Note : It is recommended to download the latest version.

Step-2 Save the downloaded file in your location.

Step-3 Set the property. (for setting the property just copy the location of chrome driver from your system and paste it at the place of "chromeDriver.exe" in below syntax.

Syntax to set the property 
Basic Syntax to set property before launching thr chrome browser is given below .
System.setProperty(“webdriver.chrome.driver”, “chromeDriver.exe path”);

Example -
Here the real time example of set property is given .
System.setProperty("webdriver.chrome.driver","/lib/chromeDriver/chromedriver.exe");

Selenium Code To Launch The Chrome browser Using Java
code: import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.chrome.ChromeDriver;

public class LauchChrome
{
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver","D:/abc/Soft/chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.facebook.com"); 
driver.manage().window().maximize();
driver.quit();
}
}

In this tutorial we learn how to Launch Chrome Browser in selenium webdriver .Hope this tutorial helpful for you 😊

Thanks & Regards 
Sandeep Yadav

Related Post :

  • How to launch chrome browser in selenium webdriver ? 
  • How to launch firefox browser in selenium webdriver ?
  • How to Close browser window in selenium webdriver ?
  • How to delete cookies in selenium webdriver ?

Important Tags :
how to launch Chrome browser in selenium , how to run browser in selenium webdriver , how to launch Chrome browser in selenium using java , Launching browser in selenium webdriver 


How To Launch Chrome Browser in Selenium Webdriver



Post a Comment

0 Comments