绕过“外部协议请求"硒自动化期间弹出
我在 mac 和 ubunto 上运行自动化(使用 cucumber、selenium web driver、junit)
I'm running an automation on mac and on ubunto (using cucumber, selenium web driver, junit)
在自动化过程中,我单击非 http 协议的链接
during the automation I click a link with non http protocol
出现外部协议请求"弹出窗口.
an "External protocol request" popup appears.
它阻止我的测试测试网页的其余部分.
It blocks my test from testing the rest of the webpage.
如何轻松绕过?
我想过可能写一个什么都不做的 jar,然后将它注册到这个外部协议,但这无济于事,因为这个弹出窗口仍然会出现.
I have thought maybe to write a jar that does nothing and then register it to this external protocol, but it won't help as this popup will still appear.
也许使用其他浏览器会有所帮助?
Maybe using another browser can help?
还有其他建议吗?
推荐答案
您有 2 个可能的选项.
You have 2 possible options.
1) 正在运行具有预定义配置文件的 chrome,您已手动禁用协议处理(通过接口或配置文件)(配置文件设置中的本地状态"文件,您应该在相应部分添加位智":false,你可以搜索mailto"知道它在哪里).
1) Is running a chrome with a predefined profile, where you have disabled protocol handling manually (via interface or config file) ("Local State" file in profile settings, you should add "waze": false in the appropriate section, you can search for "mailto" to know where is it).
2) 另一种方法是在所有测试开始之前将设置放入测试的构造函数中(我将编写一个算法,因为它取决于您的框架和语言):
2) Another way is to put put the setting in your tests' constructor before all your tests will start (I'll write an algo, because it depends on your framework and language):
- 导航到chrome://settings"
- 使用 CSS 选择器#advanced-settings-expander"点击链接
- 使用 CSS 选择器#privacyContentSettingsButton"按下按钮
- 使用 css 选择器#handlers-section input[value=block]"按所需选项的标签
- 通过 CSS 选择器#content-settings-overlay-confirm"按下完成
相关文章