-3
我想设置多个期望的功能,为硒驱动程序对象的一个实例。 我想让浏览器先设置文件的下载位置 ,然后在Chrome浏览器中禁用pdf查看器插件。任何人都可以协助Selenium多个期望的功能设置
禁用PDF浏览器插件的代码片段:
DesiredCapabilities caps = DesiredCapabilities.chrome();
Map<String, Object> preferences = new HashMap<String, Object>();
preferences.put("plugins.plugins_disabled", new String[] { "Chrome PDF Viewer" });
ChromeOptions options1 = new ChromeOptions();
options1.setExperimentalOption("prefs", preferences);
caps.setCapability(ChromeOptions.CAPABILITY, options1);
设置下载位置的代码片段:
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("download.default_directory", "C:\\Users\\user\\Downloads\\");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
caps.setCapability(ChromeOptions.CAPABILITY, options);
这完全不清楚您要问什么。请阅读[问]。如果您对英文不熟悉,请考虑使用Google翻译器。 – xenteros
我想为Chrome驱动程序的一个实例设置多个所需的功能。我想设置Chrome浏览器下载位置,并在浏览器实例中禁用PDF查看器。 –
发布您尝试过的代码。 – tak3shi