Notebooks >> Scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
1.2 KiB

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("prefs", new HashMap<String, Object>(){
{
put("profile.default_content_settings.popups", 0);
put("download.default_directory", "/home/selenium/Downloads");
put("download.prompt_for_download", false);
put("download.directory_upgrade", true);
put("safebrowsing.enabled", false);
put("plugins.always_open_pdf_externally", true);
put("plugins.plugins_disabled", new ArrayList<String>(){
{
add("Chrome PDF Viewer");
}
});
}
});
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), chromeOptions);
driver.navigate().to("http://example.com/myfile.odt");
options.add_experimental_option("excludeSwitches",
["ignore-certificate-errors", "safebrowsing-disable-download-
protection",
"safebrowsing-disable-auto-update",
"disable-client-side-phishing-detection"])
# options.add_extension('/data/cjpalhdlnbpafiamejdnhcphjbkeiagm.crx') # origin