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 18, 2018 in Selenium by Atul
• 10,240 points
1,143 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 18, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

0 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 5, 2018 in Selenium by nsv999
• 5,070 points
3,927 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,610 points
2,668 views
0 votes
1 answer

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,070 points
443 views
0 votes
1 answer
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,130 points
791 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
433 views
0 votes
1 answer
0 votes
1 answer