如何在Selenide中获取/设置文件下载路径

时间:2019-10-08 09:21:27

标签: selenide

我是硒精的新手。我想在selenide中设置/获取文件下载路径。 我试过了: Configuration.browserCapabilities.setCapability(“ download.prompt_for_download”,true);             Configuration.browserCapabilities.setCapability(“ download.default_directory”,“ D:\ HYLA”);

        String downloadFilepath = "D:\\downloadPath";
        HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
        chromePrefs.put("profile.default_content_settings.popups", 0);
        chromePrefs.put("download.default_directory", downloadFilepath);
        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("prefs", chromePrefs);
        DesiredCapabilities cap = DesiredCapabilities.chrome();
        cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        cap.setCapability(ChromeOptions.CAPABILITY, options);
        WebDriver driver = new ChromeDriver(cap);

但是它不适用于硒化物。请帮助我。

0 个答案:

没有答案