绕过“外部协议请求”硒自动化期间的弹出窗口 [英] Bypass "External protocol request" popup during selenium automation

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

问题描述

我在mac和ubunto上运行自动化(使用黄瓜,selenium web驱动程序,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种可能的选择。

1)运行带有预定义配置文件的chrome,您已手动禁用协议处理(通过接口或配置文件)(配置文件设置中的Local State文件) ,你应该在相应的部分添加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

  • navigate to "chrome://settings"
  • press link with css selector "#advanced-settings-expander"
  • press button with css selector "#privacyContentSettingsButton"
  • press label with the needed option using css selector "#handlers-section input[value=block]"
  • press done via css selector "#content-settings-overlay-confirm"

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆