Sunday, August 3, 2014

Chrome driver initialization in Webdriver

Follow to below steps to work with Chrome 

1. Download the chrome driver 2.41.0
        Those who use maven, you could copy paste this dependency in your pom.xml
<dependency><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-chrome-driver</artifactId><version>2.41.0</version></dependency>
2.    If you work in mac machine, download chromedriver unix executable. If you work in windows machine, download chromedriver.exe
You could get it here
3. Save the chromedriver in your project path.

4. Refer the below code and initialize your chrome driver.
    String path_to_chromedriver_executable = System.getProperty("user.dir")+"/src/test/resources/chromedriver";  //mention the location where you kept your chromedriver unix executable or chromedriver.exe
         
System.setProperty("webdriver.chrome.driver", path_to_chromedriver_executable);
            ChromeOptions options = new ChromeOptions();
            options.addArguments ("--test-type" );
        driver = new ChromeDriver(options);

5. You are ready to launch chrome browser. Happy Testing!!!!!

No comments:

Post a Comment