Selenium Chromedriver forces Chrome to launch without pre-configured plugins, bookmarks or other settings

I am a new Selenium user. I want to use it to launch 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 normally, but without the plugins configured, my settings or bookmarks. What should I do to download it? Thank.

+3
source share
1 answer

You must first read the document with the chrome key in the selenium wiki. Its available here - http://code.google.com/p/selenium/wiki/ChromeDriver

As mentioned in the wiki: - Similarly, to download the 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);
+5
source

All Articles