Here is my test code, because Chrome's webdriver is not installed by default, so you must go to http://code.google.com/p/chromedriver/downloads/list download chromedriver
Select Win32 version of CHROMEDRIVER download under Windows System.
public static void Main (string[] args) {
TODO auto-generated Method Stub
String url = "Http://www.youdao.com";
System.setproperty ("Webdriver.chrome.driver", "C:/Program Files (x86)/google/chrome/application/chromedriver.exe" );
Webdriver Driver = new Chromedriver ();
Driver.get (URL);
Navigation Navigation = Driver.navigate ();
Navigation.to (URL);
}
Most of the online articles are some to system.setproperty, but many have not written all, in this special statement:
The first parameter of the SetProperty function must be webdriver.chrome.driver, and The second parameter is the installation directory of Chromedriver.exe
Here I put the downloaded Chromedriver decompression under the Chrome installation directory, as shown in:
Selenium Webdriver in the Chrome browser configuration