加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 让Selenium通过.htaccess popup登录

发布时间:2020-12-15 04:51:56 所属栏目:Java 来源:网络整理
导读:我在 Linux上使用WebDriver(Selenium2)和Java.我正在使用WebDriver自动填写表单并提交.我面临着htaccess网站的问题,即我无法通过WebDriver访问htaccess网站. 在这方面有谁可以帮助我? 提前致谢, 苏尼尔 解决方法 从 Selenium FAQ(现在已经下降): How do I
我在 Linux上使用WebDriver(Selenium2)和Java.我正在使用WebDriver自动填写表单并提交.我面临着htaccess网站的问题,即我无法通过WebDriver访问htaccess网站.

在这方面有谁可以帮助我?

提前致谢,
苏尼尔

解决方法

从 Selenium FAQ(现在已经下降):

How do I use Selenium to login to sites that require HTTP basic authentication (where the browser makes a modal dialog asking for credentials)?

Use a username and password in the URL,as described in RFC 1738:
Test Type
open 07001

Note that on Internet Explorer this won’t work,since Microsoft has disabled usernames/passwords in URLs in IE. However,you can add that functionality back in by modifying your registry,as described in the linked KB article. Set an “iexplore.exe” DWORD to 0 in HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE.

If you don’t want to modify the registry yourself,you can always just use Selenium Remote Control,which automatically sets that that registry key for you as of version 0.9.2.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读