Leadfoot绕过IE证书警告
Leadfoot bypass IE certificate warning
我正试图在运行internet/selement/leadfoot测试的客户端的浏览器中执行javascript。具体来说,我试图绕过IE8&9证书警告。
以前,使用selenium-python绑定,我可以使用此代码在所有浏览器上运行,如果发生这种情况,会传递警告:
if "Certificate" in driver.title:
driver.get("javascript:document.getElementById('overridelink').click();")
现在使用铅脚,我已经尝试了以下的许多组合:
.get(require.toUrl('https://secure-url.com')
.execute("document.getElementById('overridelink').click();")
// OR
.get("javascript:document.getElementById('overridelink').click();")
但无法在客户端上执行此javascript。有人在这方面取得了成功吗?
.execute('alert("hello");')
适用于其他页面,但不适用于此页面。就好像leadfoot无法在这个安全页面中运行JS,但selenium-api是吗?
最终它失败了,并出现错误:
JavaScriptError: [POST http://localhost:4444/wd/hub/session/1fa8a4a3-8774-46af-ad87-0e8fbc5a1388/execute / {"script":"document.getElementById('overridelink').click();","args":[]}] JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30 milliseconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'IE9Win7', ip: '169.254.0.207', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_67'
Session ID: 8b20796a-1d40-48ad-82e1-25ce16a40f17
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false, enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=9, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false, handlesAlerts=true, initialBrowserUrl=http://localhost:29797/, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
at Server._post <node_modules'intern'node_modules'leadfoot'Server.js:68:9>
...
此外,我可以在WebDriverIO中确认,我可以用绕过警告
client.url("javascript:document.getElementById('overridelink').click();")
我能够成功地浏览证书错误页面,方法是将键发送到选项卡,通过页面到覆盖链接,然后输入如下:
.pressKeys([Keys.TAB, Keys.TAB, Keys.TAB, Keys.ENTER])
显然,可能有更好的方法,但这是有效的。
示例:
var command = this.remote;
return command
.get(require.toUrl('https://portal-stg.vpc.locusdev.net'))
.getPageTitle()
// IE Certificate Error Workaround
.then(function(title) {
if (title.indexOf('Certificate Error') !== -1) {
command.pressKeys([Keys.TAB, Keys.TAB, Keys.TAB, Keys.ENTER])
}
return true;
})
相关文章:
- chrome扩展更改主机/域警告
- 如何永久停止jshint'只读'警告/错误
- JShint-.jshintrc中的ES6有esversion,但仍收到警告(使用atom)
- Webpack UglifyJS仍在发出警告消息
- 我确实有一个表单,如果用户输入了输入,它应该检查否定或空的输入框,并抛出一条警告消息
- React Router一直给我一个警告:你不能更改<路由器路由>
- 为什么Grunt Copy给了我一个'undefined不是函数'警告
- 执行此代码时,我看不到警告框
- 页面中的声学警告
- 在Resharper中禁用javascript类型强制警告
- npm警告包.jsonCrackingJS@0.0.1没有存储库字段
- 为什么JavaScript对话框(警告、确认)会停止页面重绘
- 尝试在两次迭代中警告同一选择器的值,在第一次迭代中得到正确的值,而在第二次迭代中获得不正确的值.为什么?
- 警告密码的jquery值错误
- 我一直收到的控制台警告是什么?推迟长时间运行的计时器任务以提高滚动的流畅性
- 警告:失败的propType:类型为“array”的无效prop应为React的“object”
- 解析云代码不会记录/警告成功或失败
- 尝试设置时间时Moment JS Deprecation警告
- 在html页面的iframe中显示一个警告框
- Leadfoot绕过IE证书警告