Selenium 中的 Adobe Flash,Chrome 54.0.2840.59-1:"This plugin is not supported"
Adobe Flash in Selenium, Chrome 54.0.2840.59-1: "This plugin is not supported"
Chrome 54.0.2840.59-1 的最新更新导致 selenium 无法加载 Flash 插件。 chrome://plugins/
中的 Adobe Flash Player 已禁用,但在 Chrome 的先前版本中也已禁用。
只有当 Chrome 驱动程序启动时才会在测试中出现这种情况,在正常的 Chrome 浏览器中导航到 Flash 站点没有任何问题。
从 Chrome 53 年开始,they have blocked flash 从他们的浏览器上加载。您使用的是 54,因此适用。
其次,Selenium不能自动化Flash,所以我觉得这个问题无论如何都没有意义。如果你需要自动化闪存,你应该考虑另一个库。
@sircapsalot:这是可能的,而且我们确实为内置于 Flash 中的应用程序实现了自动化。它要求我们添加自定义 flex 处理程序,然后可以通过 javascript.
调用这些处理程序
Linux:为了让 flash 在 chrome54 上工作,我从我的 /usr/google-chrome 中获取了插件文件的工作副本,然后我可以在命令中使用 pass chrome驱动程序的行参数:
ClassLoader classLoader = getClass().getClassLoader();
File flashPath = new File(classLoader.getResource("libpepflashplayer.so").getFile());
ChromeOptions options = new ChromeOptions();
options.addArguments("--ppapi-flash-path=" + flashPath);
return new ChromeDriver(serviceBuilder.build(), options);
Windows:@user7038292 手动安装 flash 的解决方案解决了问题
安装 Flash 为我解决了这个问题,我之前使用 chrome 的 pepperflash 遇到了您描述的相同问题。
从 https://get.adobe.com/flashplayer/ 安装 flash 播放器适用于 mac OS,请注意,您需要在 chrome 驱动程序浏览器(不是 chrome 系统中的浏览器)。为此,运行 您的 selenium 测试会打开 chrome 并从那里转到 URL ^ 并按照安装步骤进行操作。完成后,下次 运行 测试时,它应该会接受更改并正常工作。
Chrome 54 不支持 Adobe Flash Player NPAPI anymore.So 您只需要在系统的 chrome 浏览器上安装 Adobe Flash Player PPAPI(来自 https://get.adobe.com/flashplayer/ ) .
HashMap<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("plugins.plugins_enabled", new String[] {
"Chrome PDF Viewer",
"Native Client"
});
chromePrefs.put("plugins.plugins_disabled", new String[] {
"Adobe Flash Player"
});
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
Chrome 54.0.2840.59-1 的最新更新导致 selenium 无法加载 Flash 插件。 chrome://plugins/
中的 Adobe Flash Player 已禁用,但在 Chrome 的先前版本中也已禁用。
只有当 Chrome 驱动程序启动时才会在测试中出现这种情况,在正常的 Chrome 浏览器中导航到 Flash 站点没有任何问题。
从 Chrome 53 年开始,they have blocked flash 从他们的浏览器上加载。您使用的是 54,因此适用。
其次,Selenium不能自动化Flash,所以我觉得这个问题无论如何都没有意义。如果你需要自动化闪存,你应该考虑另一个库。
@sircapsalot:这是可能的,而且我们确实为内置于 Flash 中的应用程序实现了自动化。它要求我们添加自定义 flex 处理程序,然后可以通过 javascript.
调用这些处理程序Linux:为了让 flash 在 chrome54 上工作,我从我的 /usr/google-chrome 中获取了插件文件的工作副本,然后我可以在命令中使用 pass chrome驱动程序的行参数:
ClassLoader classLoader = getClass().getClassLoader(); File flashPath = new File(classLoader.getResource("libpepflashplayer.so").getFile());
ChromeOptions options = new ChromeOptions(); options.addArguments("--ppapi-flash-path=" + flashPath);
return new ChromeDriver(serviceBuilder.build(), options);
Windows:@user7038292 手动安装 flash 的解决方案解决了问题
安装 Flash 为我解决了这个问题,我之前使用 chrome 的 pepperflash 遇到了您描述的相同问题。
从 https://get.adobe.com/flashplayer/ 安装 flash 播放器适用于 mac OS,请注意,您需要在 chrome 驱动程序浏览器(不是 chrome 系统中的浏览器)。为此,运行 您的 selenium 测试会打开 chrome 并从那里转到 URL ^ 并按照安装步骤进行操作。完成后,下次 运行 测试时,它应该会接受更改并正常工作。
Chrome 54 不支持 Adobe Flash Player NPAPI anymore.So 您只需要在系统的 chrome 浏览器上安装 Adobe Flash Player PPAPI(来自 https://get.adobe.com/flashplayer/ ) .
HashMap<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("plugins.plugins_enabled", new String[] {
"Chrome PDF Viewer",
"Native Client"
});
chromePrefs.put("plugins.plugins_disabled", new String[] {
"Adobe Flash Player"
});
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);