Wednesday, February 26, 2014

Opening a weib site through Chrome driver


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SeleniumwebdriverExwithChrome {

    public static void main(String[] args) {
       
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");//C:\\chromedriver.exe -- is the path of drivers on my machine
        //System.setProperty("webdriver.chrome.driver", "C:\\Users\sreekanth\Desktop\Technical\Selenium\Selenium training\chromedriver_win32\chromedriver.exe");
//firefox does not need driver to be downloaded by chrome need drivers to be downloaded from seleniumhq.com site.
WebDriver driver = new ChromeDriver();
/*
driver.get("http://www.google.com"); //it is able to open google website
//driver.get("www.google.com"); //Issue: it is not opening google site
//driver.close(); // it is able to close browser
System.out.println("The web page title is: " + driver.getTitle());
final String title = driver.getTitle();
System.out.println(title); */
    }

}

No comments:

Post a Comment