Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
2 views
by (120 points)
I am Test Automation Engineer, working with Selenium and java. I am developing selenium automation tests but I have a problem with downloading something from the software I am 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?

Chrome version:80.0 Selenium version: 3.8.1 Chromedriver version: 2.42

I found these codes 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

I hope to get a reply from you. Thank you.

Please log in or register to answer this question.

Browse Categories

...