【发布时间】:2018-10-11 20:39:32
【问题描述】:
作为 CI 流程的一部分,我正在尝试自动执行与 Flash 应用程序的一些交互。在使用 Selenium Standalone Server 无头运行 chrome(通过 xvfb-run)时,我在启用 flash 时遇到了麻烦。我做了很多搜索,但到目前为止还没有找到任何有用的东西。
我目前正在使用它,但如果某处有已知的工作配置,我愿意切换到不同的版本...
- Selenium 独立服务器 3.11
- Chromedriver 2.33
- 铬 65.0.3325.181
- Java 8
当我第一次开始使用它时,我会在页面上收到一条警告,说我需要启用 Adobe Flash Player。我通过使用来自https://sqa.stackexchange.com/questions/30312/enable-flash-player-on-chrome-62-while-running-selenium-test 的以下内容“过去”了该消息:
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_setting_values.plugins", 1);
prefs.put("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
prefs.put("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);
// Enable Flash for this site
prefs.put("PluginsAllowedForUrls", "ourapp.com");
options.setExperimentalOption("prefs", prefs);
WebDriver driver = new ChromeDriver(options);
driver.get("ourapp.com");
在加载我们的应用程序时,页面现在会给出一个稍微不同的消息,我无法理解。有没有办法解决这个问题,或者有没有其他方法可以默认启用 Flash?
Restart Chrome to enable Adobe Flash Player
提前感谢您的帮助!
【问题讨论】:
标签: java flash selenium-chromedriver google-chrome-headless