disabling virus scan on google chrome inside python script for downloads
Asked Answered
C

1

6

I am downloading some excel files from a website via python script, via Google Chrome. For some reason, some of the downloaded files fail the virus scan and get deleted immediately without any prompt. I know these are safe files because if I manually download them, they always pass the virus scan.

Is there any way to disable the virus scan on Google Chrome from within the python script as the script starts and enable virus scan again upon finish?

Following is my preference setting for Chromedriver:

options.add_experimental_option("prefs", 
    {  "download.default_directory": r'{}\captive_IL'.format(temppath),  
       "download.prompt_for_download": False,  
       "download.directory_upgrade": True,  
       "safebrowsing.enabled": False})

Here is the link which lists all of the preference options available for selenium chromedriver, I couldn't find a virus scan upon download option in this list.

https://cs.chromium.org/chromium/src/chrome/common/pref_names.cc

Chatman answered 14/9, 2017 at 21:56 Comment(3)
Have you tried the "download_restrictions" options? In Java or .NET, we have this option for chromedriver "--allow-unchecked-dangerous-downloads[3]" . Check assertselenium.com/java/… . Not sure what in python.Hitchcock
@Hitchcock Thank you for the comment, I found the option for python, I am posting the detail in the answer now.Chatman
Upvote, If my comment helped. That will encourage a lot.Hitchcock
C
9
safebrowsing.disable_download_protection

The above flag when set to True, disables the automatic file deletion that occurs upon a failed virus scan. Although on the GoogleChrome browser window you still see the virus scan failing for the download file. Nonetheless, the file stays in the downloads folder and then we can use it however we want.

Chatman answered 15/9, 2017 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.