How to disable "this type of file can harm your computer" in ChromeDriver?

2,350 views
Skip to first unread message

Eric Liu

unread,
Jan 7, 2020, 1:11:42 PM1/7/20
to Selenium Users
I'm trying to automate the download of an XML file but it keeps getting blocked by this warning message. I can't interact with the message via the driver and all the solutions online seem to be deprecated. 
Any way to disable these popups so it will automatically accept the download?

Thanks

Eric Liu

unread,
Jan 7, 2020, 1:34:35 PM1/7/20
to Selenium Users
Using Java, ChromeDriver, and Windows 10

Joe Ward

unread,
Jan 7, 2020, 2:14:06 PM1/7/20
to seleniu...@googlegroups.com
There's no way of answering this question without telling us what sort of popup you're referring to.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3ee8a20a-fdee-4735-bea6-2f9592378ac1%40googlegroups.com.

Eric Liu

unread,
Jan 7, 2020, 2:18:57 PM1/7/20
to seleniu...@googlegroups.com
The "this type of file can harm your computer" popup
image.png

You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/Y8gaIovpt9c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJPyTs0mVfvXmsxn-BUXZBWhRn_RQYJ5tb%2BrGkn1shRbHGp8nw%40mail.gmail.com.

Joe Ward

unread,
Jan 7, 2020, 2:47:03 PM1/7/20
to seleniu...@googlegroups.com
Ah, that's not really something Selenium can "handle". 

You are probably seeing a lot of resources recommending you launch the browser with --safebrowsing-disable-download-protection, but that won't work either as safe browsing us now the default behavior.

An option might be to create a profile where you have done what's described here https://support.google.com/chrome/answer/99020?co=GENIE.Platform%3DDesktop&hl=en and load that profile when you launch the browser. 

To be honest though checking downloads isn't exactly what Selenium is good for...

Thiago Salgado

unread,
Jan 7, 2020, 3:17:21 PM1/7/20
to seleniu...@googlegroups.com
Just take URL link and use wget tô download it

Eric Liu

unread,
Jan 8, 2020, 12:52:46 PM1/8/20
to seleniu...@googlegroups.com
I am not downloading via a link but rather creating an output. Can anyone else confirm there is no way to avoid the popup? Seems odd since there was a way back then until it was patched.

Joe Ward

unread,
Jan 8, 2020, 1:10:57 PM1/8/20
to seleniu...@googlegroups.com
You find it odd that Chromium would make protected browsing default? Did you have any luck with my other suggestion? 

The list of command line switches Chrome accepts is here 
https://peter.sh/experiments/chromium-command-line-switches/, feel free to try and find one that fits your needs. 


Reply all
Reply to author
Forward
0 new messages