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

后端 未结 8 1678
时光取名叫无心
时光取名叫无心 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:34

    Im using Google Version 80.0.3987.122 (Official Build) (32-bit) and ChromeDriver 80.0.3987.106. Getting the same error even after adding the below while downloading a .xml file.

    $ChromeOptions = New-Object OpenQA.Selenium.Chrome.ChromeOptions
    $ChromeOptions.AddArguments(@(
        "--disable-extensions",
        "--ignore-certificate-errors"))
    
    $download = "C:\temp\download"
    $ChromeOptions.AddUserProfilePreference("safebrowsing.enabled", "true");
    $ChromeOptions.AddUserProfilePreference("download.default_directory", $download);
    $ChromeOptions.AddUserProfilePreference("download.prompt_for_download", "false");
    $ChromeOptions.AddUserProfilePreference("download.directory_upgrade", "true");
    
    $ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver($chromeOptions)
    

提交回复
热议问题