I'm Test Automation Engineer
, working with Selenium
and Java
. I'm developing selenium automation tests
, but I have a problem with downloading something from the software I'm working on.
Chrome
asks me the security question in order to download Keep or Discard
, but in selenium
, as you know I cant click the Chrome
window.
So I did try a few methods to get rid of this problem in Chrome
, but I couldn't find a solution and this is important for me to continue to develop automation, that's why I wanted to ask if you know a solution to this issue.
I download the XML
file or cer
file, I get a This type of file can harm your computer
pop up. I want to disable this pop up using selenium ChromeDriver
and I want these types of files to be downloaded always. How can this be done?
My configuration:
- Chrome version:80.0
- Selenium version: 3.8.1
- Chromedriver version: 2.42
I found this code, but cap object in DesiredCapabilities
doesn't work with ChromeDriver
anymore;
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", downloadFilepath);
chromePrefs.put("safebrowsing.enabled", "true");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(cap); //this driver doesnt work anymore
Any ideas?