Download MP4 file instead of playing it using ChromeDriver?

后端 未结 3 1914
半阙折子戏
半阙折子戏 2020-12-16 02:33

I\'m using Chrome Web Driver 2.10 chromedriver_win32.zip with Selenium WebDriver 2.31.2.

With verbose logging enabled it seems the DesiredCapabilities

3条回答
  •  醉话见心
    2020-12-16 03:27

    ChromeOptions options = new ChromeOptions();
    Map prefs = new HashMap();
    prefs.put("profile.default_content_settings.popups", 0);
    prefs.put("download.default_directory", getClass().getResource("/data/input").toString().replace("%20", " ").replace("file:","").replaceFirst("/", ""));
    options.setExperimentalOption("prefs", prefs);
    
    options.addArguments("--test-type");
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    

提交回复
热议问题