selenium如何解决window安全验证问题
2015-06-04 13:53
477 查看
解决办法
IE浏览器:
1.使用autoit,捕捉到控件后,编写au3脚本,生成exe,然后java调用exe
au3脚本
java调用代码,可以自行把绝对路径改成相对路径
2.更改注册表
保存下面内容保存为reg,双击
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]
"iexplore.exe"=dword:00000000
火狐浏览器
在地址前面加上用户名和密码,如:http://username:password@127.0.0.1:8888/index
参考资料:http://m.blog.csdn.net/blog/lan0227/36384201
http://blog.csdn.net/max229max/article/details/34456507
IE浏览器:
1.使用autoit,捕捉到控件后,编写au3脚本,生成exe,然后java调用exe
au3脚本
Dim $account = "username" Dim $pwd = "password" Dim $dialogTitle = "Windows 安全" WinActivate($dialogTitle) WinWaitActive($dialogTitle) Sleep(1*100) ControlSetText($dialogTitle,"","Edit1",$account) Sleep(1*100) ControlSetText($dialogTitle,"","Edit2",$pwd ) ControlClick($dialogTitle,"","Button2") Sleep(1*100)
java调用代码,可以自行把绝对路径改成相对路径
Runtime rn = Runtime.getRuntime(); Process p = null; try { p = rn.exec("\"D:/workspace/test.exe\""); } catch (Exception e) { System.out.println("Error exec!"); }
2.更改注册表
保存下面内容保存为reg,双击
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]
"iexplore.exe"=dword:00000000
火狐浏览器
在地址前面加上用户名和密码,如:http://username:password@127.0.0.1:8888/index
参考资料:http://m.blog.csdn.net/blog/lan0227/36384201
http://blog.csdn.net/max229max/article/details/34456507
相关文章推荐
- TextView 的ScrollView滚动效果
- android TextView 带滚动条,和ScrollView 用法(暂时觉得ScrollView滑动速度比较快)
- Objective -C内存管理
- JQuery.Ajax之错误调试帮助信息
- Android的xml/assets/raw资源使用详解
- PHP数组操作汇总 php数组的使用技巧
- 使用visual studio 2013 快速搭建phonegap开发环境
- Duang ! P6 PPM 说好的R9呢?
- 分享一下source insight 3.5的快捷配置及我的utils.em
- SGU124 Broken line
- 我的第一个HTML5应用
- iOS_引入代码块的步骤
- 黑马程序员-Java之自定义图形化界面的浏览器访问本地的Tomcat服务器
- Android开发模板------自己定义SimpleCursorAdapter的使用
- 构造函数
- DBA 给某用户赋予某张数据库表的某种操作权限(增,删,查,改)
- 各种图的创建以及广度,深度优先遍历(临接矩阵存储)
- Spring mvc绑定日期参数的最佳解决方案
- 条件注释判断浏览器
- protobuf中会严重影响时间和空间损耗的地方