google chrome - ChromeDriver 2.29 Unable to set automatic downloads to Allow by default -
after upgrading chromedriver 2.29, default value 'automatic downloads 'localhost:9000' set 'ask'. whenever tests clicks on link invokes download, save windows dialog opens up. download silently default downloads folder of chrome.
how change setting's default value 'allow' in chromedriver (not chrome)?
i've tried using chrome.switches didn't work:
chrome.switches=--disable-extensions,--disable-infobars,--allow-insecure-localhost,--safebrowsing-disable-download-protection the default setting in chrome 'allow' sites. 'http://localhost:9000' has been added exceptions list.
you can set default download location using capabilities. download file folder, won't give pop up's
just try below line of code
desiredcapabilities capabilities = new desiredcapabilities(); string downloadpath = system.getproperty("user.dir")+ "\\downloads"; hashmap<string, object> chromeprefs = new hashmap<>(); chromeprefs.put("download.default_directory", downloadpath); chromeprefs.put("profile.default_content_settings.popups", 0); chromeprefs.put("safebrowsing.enabled", "true"); chromeoptions options = new chromeoptions(); hashmap<string, object> chromeoptionsmap = new hashmap<>(); options.setexperimentaloption("prefs", chromeprefs); options.addarguments("--test-type"); capabilities = desiredcapabilities.chrome(); capabilities.setcapability(chromeoptions.capability,chromeoptionsmap); capabilities.setcapability(chromeoptions.capability, options); capabilities.setcapability(capabilitytype.accept_ssl_certs, true); let me know if face issue

Comments
Post a Comment