selenium-webdriver - 如何在 webdriver 中使用 firefoxprofile 消除 "allow <website> to run ' silverlight'?"在 Firefox 上的警报

标签 selenium-webdriver webdriver selenium-firefoxdriver

在使用机器人 API 拖放时,我的鼠标位置受到询问“允许运行 silverlight?”的警报的干扰(在全屏模式下运行 Firefox)。甚至我的 webdriver api 也会受到此警报的影响,因为原本在一个按钮上发生的点击却在另一个按钮上执行。

我正在使用 WebDriver 来自动化我的场景,并结合机器人 api 进行拖放。有没有办法在 Firefox 配置文件中设置一些内容,这样就不会出现此警报?

下图显示了警报

https://drive.google.com/file/d/0B36CJTZFg52aUFhvWmZIVzNleEk/view?usp=sharing

最佳答案

在 Windows 上您可以执行以下操作:

// Enable Silverlight
profile.setPreference("plugin.state.npctrl", 2);

在 OSX 上:

// Enable Silverlight
profile.setPreference("plugin.state.silverlight", 2);

在 Windows 上,DLL 名称是 npctrl.dll,因此我相信这就是“npctrl”的来源。您可以从以下位置看到这一点:

about:plugins

对于 Linux,您必须检查。打开两个选项卡,其中一个用于:

about:addons

另一个用于:

about:config

在 about:addons 中,Silverlight 插件可以始终激活。

在 about:config 中按“plugins.state”过滤。当您更改 about:addons 中的激活状态时发生更改的项目是您添加到 FireFox 配置文件中的项目。

关于selenium-webdriver - 如何在 webdriver 中使用 firefoxprofile 消除 "allow <website> to run ' silverlight'?"在 Firefox 上的警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26843852/

相关文章:

python - 点击滑溜溜的 "ElementNotVisibleException"按钮selenium webdriver python

java - Firefox 身份验证弹出窗口出现错误 : User prompt of type promptUserAndPass is not supported

android - 使用 Appium 时,Android 物理设备中的键盘并不总是隐藏的

selenium-webdriver - Specflow - 如何进行待定测试以使整个测试不失败

java - 如何检查 for 循环中的条件并打印一次语句?

java - 使用 webdriver API 实现 BDD (JBehave+Webdriver)

java - Maven、testng、surefire : not running AfterClass

python-3.x - Python - 它被认为更适合抓取 : selenium or beautifulsoup with selenium?

python - 如何使用Appium和Python定位元素?

selenium - 对 Selenium 测试人员使用 Marionette FirefoxDriver 而不是旧的 Selenium FirefoxDriver 有什么好处?