3

I am a new user of Selenium. I want to use it to start up the Chrome browser but I have a problem.

public static void processor(String url, String name) {     
    System.setProperty("webdriver.chrome.driver", "C:/Documents and Settings/jingxiong/Local Settings/Application Data/Google/Chrome/Application/chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get(url);
    WebElement element = driver.findElement(By.name(name));
    element.sendKeys("google");
    element.submit();
    System.out.println("Page title is: " + driver.getTitle());
    driver.quit();
} 

When I run this example the Chrome browser starts ok but without configured plugins, my settings or bookmarks. What should I do to cause it load these? Thank you.

J.Churchill
  • 430
  • 3
  • 12
yuxing
  • 47
  • 1
  • 6

1 Answers1

5

You should first read chromedriver document in selenium wiki. Its available here - http://code.google.com/p/selenium/wiki/ChromeDriver

As mentioned in the wiki:- Similarly, to load an extension when Chrome starts:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
  capabilities.setCapability("chrome.switches", Arrays.asList("--load-extension=/path/to/extension/directory"));
  WebDriver driver = new ChromeDriver(capabilities);
A.J
  • 4,929
  • 2
  • 27
  • 36