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

后端 未结 8 1683
时光取名叫无心
时光取名叫无心 2020-11-27 20:43

I\'m using selenium chromedriver 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

8条回答
  •  我在风中等你
    2020-11-27 21:46

    For context, I had a .csv with a list of .swf flash documents and their respective urls. Since the files could only be accessed after a valid login, I couldn't use a simple requests based solution.

    Just like .xml, downloading a .swf triggers a similar prompt.

    None of the answers worked for me.

    So I stripped away all the extra arguments and settings the above answers proposed and just made the chrome instance headless.

    options.add_argument("--headless")
    
    prefs = {
        "download.default_directory": "C:\LOL\Flash",
        "download.prompt_for_download": False,
        "download.directory_upgrade": True,
    }
    options.add_experimental_option("prefs",prefs)
    

提交回复
热议问题