<small id='OtU8E'></small><noframes id='OtU8E'>

<legend id='OtU8E'><style id='OtU8E'><dir id='OtU8E'><q id='OtU8E'></q></dir></style></legend>
  • <i id='OtU8E'><tr id='OtU8E'><dt id='OtU8E'><q id='OtU8E'><span id='OtU8E'><b id='OtU8E'><form id='OtU8E'><ins id='OtU8E'></ins><ul id='OtU8E'></ul><sub id='OtU8E'></sub></form><legend id='OtU8E'></legend><bdo id='OtU8E'><pre id='OtU8E'><center id='OtU8E'></center></pre></bdo></b><th id='OtU8E'></th></span></q></dt></tr></i><div id='OtU8E'><tfoot id='OtU8E'></tfoot><dl id='OtU8E'><fieldset id='OtU8E'></fieldset></dl></div>
      <bdo id='OtU8E'></bdo><ul id='OtU8E'></ul>
  • <tfoot id='OtU8E'></tfoot>

      1. 如何隐藏警告“此类文件可能会损害您的计算机

        时间:2023-09-28

        • <bdo id='uMvnq'></bdo><ul id='uMvnq'></ul>
          • <tfoot id='uMvnq'></tfoot>
            <i id='uMvnq'><tr id='uMvnq'><dt id='uMvnq'><q id='uMvnq'><span id='uMvnq'><b id='uMvnq'><form id='uMvnq'><ins id='uMvnq'></ins><ul id='uMvnq'></ul><sub id='uMvnq'></sub></form><legend id='uMvnq'></legend><bdo id='uMvnq'><pre id='uMvnq'><center id='uMvnq'></center></pre></bdo></b><th id='uMvnq'></th></span></q></dt></tr></i><div id='uMvnq'><tfoot id='uMvnq'></tfoot><dl id='uMvnq'><fieldset id='uMvnq'></fieldset></dl></div>

                <tbody id='uMvnq'></tbody>

            1. <small id='uMvnq'></small><noframes id='uMvnq'>

              <legend id='uMvnq'><style id='uMvnq'><dir id='uMvnq'><q id='uMvnq'></q></dir></style></legend>
                • 本文介绍了如何隐藏警告“此类文件可能会损害您的计算机"使用带有 Selenium Java 的 Chrome Chromedriver 79 下载 .xml 文件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  尽管将 safebrowsing.enabled 设置为 true/false,但警告 ...这种类型的文件可能会损害您的计算机... 仍在浏览器中显示.如何隐藏这些信息?

                  解决方案

                  启用使用 Chrome 下载文件/

                  Despite setting safebrowsing.enabled to true / false, the warning ...This type of file can harm your computer... is still being displayed in browser. How to hide this information?

                  解决方案

                  To enable downloading of file using Chrome/ChromeDriver hiding the warning This type of file can harm your computer you need to:

                  • Add the preferences:
                    • download.default_directory
                    • download.prompt_for_download
                    • download.extensions_to_open
                    • safebrowsing.enabled
                  • As well as add the following arguments to whilelist:
                    • --safebrowsing-disable-download-protection
                    • safebrowsing-disable-extension-blacklist

                  Demonstration

                  To demonstrate downloading using selenium-chromedriver, and google-chrome through java I have clicked on the first Download link in the webpage http://www.landxmlproject.org/file-cabinet and your effective solution will be:

                  • Code Block:

                    System.setProperty("webdriver.chrome.driver", "C:\Utility\BrowserDrivers\chromedriver.exe");
                    Map<String, Object> prefs = new HashMap<String, Object>();
                    prefs.put("download.default_directory", "C:/Utility/Downloads/");
                    prefs.put("download.prompt_for_download", false);
                    prefs.put("download.extensions_to_open", "application/xml");
                    prefs.put("safebrowsing.enabled", true);
                    ChromeOptions options = new ChromeOptions();
                    options.setExperimentalOption("prefs", prefs);
                    options.addArguments("start-maximized");
                    options.addArguments("--safebrowsing-disable-download-protection");
                    options.addArguments("safebrowsing-disable-extension-blacklist");
                    WebDriver driver =  new ChromeDriver(options); 
                    driver.get("http://www.landxmlproject.org/file-cabinet");
                    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='MntnRoad.xml']//following::span[1]//a[text()='Download']"))).click();
                    

                  • Browser Snapshot:

                  这篇关于如何隐藏警告“此类文件可能会损害您的计算机"使用带有 Selenium Java 的 Chrome Chromedriver 79 下载 .xml 文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 Java 获取 chromedriver 进程 PID? 下一篇:RemoteWebDriver 抛出“org.openqa.selenium.SessionNotCreate

                  相关文章

                  最新文章

                    • <bdo id='Y5Zxm'></bdo><ul id='Y5Zxm'></ul>
                  1. <i id='Y5Zxm'><tr id='Y5Zxm'><dt id='Y5Zxm'><q id='Y5Zxm'><span id='Y5Zxm'><b id='Y5Zxm'><form id='Y5Zxm'><ins id='Y5Zxm'></ins><ul id='Y5Zxm'></ul><sub id='Y5Zxm'></sub></form><legend id='Y5Zxm'></legend><bdo id='Y5Zxm'><pre id='Y5Zxm'><center id='Y5Zxm'></center></pre></bdo></b><th id='Y5Zxm'></th></span></q></dt></tr></i><div id='Y5Zxm'><tfoot id='Y5Zxm'></tfoot><dl id='Y5Zxm'><fieldset id='Y5Zxm'></fieldset></dl></div>
                  2. <small id='Y5Zxm'></small><noframes id='Y5Zxm'>

                      <legend id='Y5Zxm'><style id='Y5Zxm'><dir id='Y5Zxm'><q id='Y5Zxm'></q></dir></style></legend>

                    1. <tfoot id='Y5Zxm'></tfoot>