How to Run Webdriver in chrome browser?

how to open chrome in selenium

How to Run Webdriver in chrome browser?

To run the Chrome browser in selenium we need to download the Chrome driver separately from the below link  It will provide you with the latest driver and it’s nothing but an ‘.exe file’.  You just need to download it and unzip the file in a proper location.

I can assume that you already know how to install selenium and setup a selenium project. If you do not know how to then you can refer to my previous post selenium installation process for the purpose of setting up a selenium project.

The next thing you need to do is to set the property for Chrome driver and specify its location via the property ‘’ as stated below.

System.setProperty("", "pathofchromedriver");

For the next part what you need to do is to provide the path of the Chrome driver. In my case, my Chrome driver is located in ‘D:/workspace/TestProject/src/chromedriver.exe’ . Here,yYou need to provide your Chrome driver path at "pathofchromedriver"; and after that, you need to initialize the chormeDriver

WebDriver  driver = new ChromeDriver();

Open the browser using the ‘get’ method


Let’s try to open a Chrome browser using selenium webdriver.
 package com.test;  
 import org.openqa.selenium.WebDriver;  
 public class SeleniumMethod {  
  static WebDriver driver;  
  public static void main(String argc[]){  
  public static void openURL(){  
  System.setProperty("", "D:/workspace/TestProject/src/chromedriver.exe");   
  driver = new ChromeDriver() ;  

Share this

Related Posts

Next Post »



your ad