我试图使用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?感谢!!!
答案 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();