WebDriver NodeJS实例化具有功能的IE驱动程序:introductionFlakinessByIgnoringProtectedModeSettings(ignoreSettings)

时间:2016-07-12 00:20:38

标签: javascript node.js selenium selenium-webdriver

我试图使用IE功能实例化一个驱动程序会话来忽略Internet Explorer中的保护模式设置,但我不确定语法。

我试过了:

    var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.ie().introduceFlakinessByIgnoringProtectedModeSettings(true).build();

    var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.ie().introduceFlakinessByIgnoringProtectedModeSettings, true.build();

    var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.ie().ignoreProtectedModeSettings(true).build();

    var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.ie().introduceFlakinessByIgnoringProtectedModeSettings(true).build();

    var driver = new webdriver.Builder().withCapabilities({ "browserName": "ie" }, {"ignoreProtectedModeSettings": "true"}).build();

 var driver = new webdriver.Builder().withCapabilities({ "browserName": "ie" }, {"introduceFlakinessByIgnoringProtectedModeSettings": "true"}).build();
到目前为止,没有人奏效。在Javascript中,这是什么正确的sytax?感谢!!!

1 个答案:

答案 0 :(得分:3)

遇到同样的问题并浏览selenium-webdriver的代码后,我发现以下内容有效:

const Capabilities = require('selenium-webdriver/lib/capabilities').Capabilities;
let capabilities = Capabilities.ie();
capabilities.set('ignoreProtectedModeSettings', true);
const driver = new webdriver.Builder().withCapabilities(capabilities).build();