How to disable This type of file can harm your computer pop up

0 votes
I'm using selenium chrome driver for automating web application. In my application, I need to download XML- files. But when I download XML file, I get 'This type of file can harm your computer' pop up. I want to disable this pop up using selenium chrome-driver and I want these type of files to be downloaded always. How can this be done?
Sep 19, 2018 in Selenium by Atul
• 10,240 points
7,780 views

1 answer to this question.

0 votes

The problem with XML files started to happen to me as of Chrome 47.0.2526.80 m. After spending maybe 6 hours trying to turn off every possible security option I tried a different approach.

Ironically, it seems that turning on the Chrome option "Protect you and your device from dangerous sites" removes the message "This type of file can harm your computer. Do you want to keep file.xml anyway?"

I am using 'Ruby' with 'Watir-Webdriver' where the code looks like this:

prefs = {
    'safebrowsing' => {
        'enabled' => true,
    }
}

b = Watir::Browser.new :chrome, :prefs => prefs

Starting the browser like this, with safebrowsing option enabled, downloads the xml files without the message warning. The principle should be the same for Selenium with any programming language.

In latest version of Google Chrome the above solution is not enough. Additionally, it is necessary to start the browser with the following switch:

--safebrowsing-disable-download-protection

Now, the code for starting the browser would look something like this:

b = Watir::Browser.new :chrome, :prefs => prefs, :switches => %w[--safebrowsing-disable-download-protection]))
answered Sep 19, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer
+3 votes
1 answer
0 votes
1 answer

How to handle Pop-up in Selenium WebDriver using Java

Actually, its pretty simple. Use this code ...READ MORE

answered Apr 6, 2018 in Selenium by nsv999
• 5,500 points
10,562 views
0 votes
1 answer

How to handle the popup of file upload in Windows OS with WebDriver?

The value of name locator has probably ...READ MORE

answered Apr 25, 2018 in Selenium by king_kenny
• 3,710 points
18,531 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,686 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,149 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,228 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,880 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP