本文介绍了绕过“外部协议请求"硒自动化期间的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 mac 和 ubunto 上运行自动化(使用黄瓜、硒网络驱动程序、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.

我怎样才能轻松绕过它?

How can I bypass it easily?

我曾想过编写一个什么都不做的 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,您已手动禁用协议处理(通过界面或配置文件)(配置文件设置中的本地状态"文件,您应该在相应部分添加waze":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"按完成

这篇关于绕过“外部协议请求"硒自动化期间的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 19:47