如何让Selenium支持http basic和Digest HTTP认证
来源:互联网 发布:医院监护仪数据怎么看 编辑:程序博客网 时间:2024/05/20 11:52
现在Selenium也没有计划实现他(详见:http://code.google.com/p/selenium/issues/detail?id=34&redir=1)
就IE来说,我们有下面几种解决方式:
1,让IE支持 "http://<user>:<password>@<host>" 的格式。这样用户名和密码就可以和URL在一起。
方法:导入下面的格式到注册表
REGEDIT4[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl][HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]"iexplore.exe"=dword:00000000"explorer.exe"=dword:00000000
然后使用
下面方式访问网页:
driver.get("http://username:password@www.basicauthprotected.com/")
2,参照http://code.google.com/p/selenium/issues/detail?id=34&redir=1
Jun 21, 2012
,I am attaching the AutoIT script i wrote to use as a work around for my automation. It does not work in Linux. The script is generic takes command line arguments to click on OK or Cancel button in authentication window.
This is just a work around 'not' a permanent / perfect solution, I am still working on it. Feel free to use if it helps.
Please follow below steps if you intend to use it.
1. Download AutoIT software and install it.
2. download loginFF.au3 script in this post attachments.
3. Open "Compile Script to .exe" utility that comes with AutoIT and store the executable in a conveninet location.
Include below steps in selenium Java Code.
String[] dialog = new String[]{ "C:\\loginFF.exe","Authentication Required","user1", "Test@123", "ok" };
Process pp1 = Runtime.getRuntime().exec(dialog);
selenium.open("/"); // Open url that gives a auth pop-up!
System.out.println("###### " + pp1.exitValue());
- 如何让Selenium支持http basic和Digest HTTP认证
- Http Basic Digest 认证
- 如何实现HTTP DIGEST认证
- HTTP认证模式:Basic and Digest Access Authentication
- HTTP协议(RFC2616)的两种认证机制(Basic和Digest)
- HTTP协议(RFC2616)的两种认证机制(Basic和Digest)
- HTTP digest认证
- Http Digest认证协议
- Http Digest认证协议
- Http Digest认证协议
- HTTP digest 认证
- Http Digest认证协议
- Http Digest认证协议
- Http Digest 认证
- http-digest的认证
- Http认证之Digest认证
- Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结Atitit HT
- tomcat配置http digest认证
- android 权限大全
- SAP SMARTFORMS 打印 CNSAPWIN 不支持页格式
- web前端工程师简介
- 【独家对话】Esri中国副总裁蔡晓兵专访 :移动信息化是延伸更是创新
- hdu 2865 基础polya问题
- 如何让Selenium支持http basic和Digest HTTP认证
- Linux下获取空闲内存和内存使用率的方法
- 转:如何将oracle彻底卸载干净
- 【独家对话】Esri中国首席技术官王昊谈 移动GIS 与 云GIS
- Spring Extension (1) — BeanPostProcessor based Logger Injection
- Android R.java文件丢失的问题
- C# String 找出匹配的数据
- 简易git使用指南 (转陈利人)
- U3d中获取模型的大小