My Thoughts: Starting Chrome Browser using WebDriver(Selenium2) with example

Thursday, May 10

Starting Chrome Browser using WebDriver(Selenium2) with example

If we would like to run our scripts on Chrome we need "chromedriver"along with the actual Chrome Browser.If you try to start the Chrome Browser with the below statement alone
WebDriver driver = new ChromeDriver();

Then you will notice below error statements

"You need to have both chromedriver and a version of chrome browser installed
@BeforeTest setUpDriver
java.lang.IllegalStateException: The path to the chromedriver executable must be set by the system property; for more information, see The latest version can be downloaded from

In our scripts if we dont specify where is chromedriver is located then we cant start chrome browser using WebDriver.

Here are steps to setup chromedriver

1.Download chromedriver from
2.Unzip the file .Say you downloaded it on your desktop folder named "Automation" and unzipped it then location will be like
C:\\Users\\<<User Name>>\\Desktop\\Automation\chromedriver_win_19.0.1068.0\\chromedriver.exe
3.Use the below code to start chrome
ChromeDriver driver = new ChromeDriver();

Now you are done. :)

If you are using the TestNG framework then here is the sample code :

import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class chromeDriver {
WebDriver  driver;

 public void setUpDriver(){
   driver = new ChromeDriver(); 

 public void start(){



  1. This is the great job for providing the nice opportunity in this blog. I had really like this information and adding two things in this technology.

  2. This was GREAT! THANKS!! Everth was clear and perfectly answered my problem! )) // Alex A.

  3. Excellent, whаt a weblog it is! This weblog provides useful facts to us, keep it up.
    Also visit my web-site : tickets online

  4. I do сonsider аll of the сoncepts yοu've introduced on your post. They are very convincing and can definitely work. Nonetheless, the posts are too short for novices. Could you please lengthen them a little from subsequent time? Thank you for the post.
    Feel free to surf my homepage Calling Cards

  5. srinivasa reddy kothaFriday, April 26, 2013

    chrome web driver is working. but when click on the any menu links in web page, brothersoft tool bar is installed. brothersoft header is displayed in the chrome wed driver browser, same code is working in FF and IE.

  6. WebDriver will always open the browser in incognito window.This is not something to do with WebDriver.

    I tried playing on google site and it worked fine.

    Can you try on other website ?