Showing posts with label webdriver. Show all posts
Showing posts with label webdriver. Show all posts

Monday, January 16, 2012

How to start chrome browser using selenium webdriver?

For starting the chrome browser follow the instructions here - http://code.google.com/p/selenium/wiki/ChromeDriver

If you find it is difficult then dont worry just download the appropriate driver associated with your OS and then use the following code -

System.setProperty("webdriver.chrome.driver","path/to/chromedriver.exe");

It is the path to your downloaded chromedriver.exe

If you have a certificate warning for your product which uses https then use the following code -

       System.setProperty("webdriver.chrome.driver","path/to/chromedriver.exe");
        DesiredCapabilities dc = DesiredCapabilities.chrome();
        String[] options = { "--ignore-certificate-errors" };
        dc.setCapability("chrome.switches", Arrays.asList(options));
        return new ChromeDriver(dc);