无法使用Selenium WebDriver在IE 11中输入用户名和密码
我想使用Selenium将用户名和密码传递给URL 我尝试了以下逻辑
I wanted to pass user name and password to a URL using Selenium I tried the below logic
1)在URL中传递用户名和密码,即 http://Uname:pwd@url.com 2)使用alert和setAuthenticationCredentials
1) Pass username and password in the URL ie) http://Uname:pwd@url.com 2) Using alert and setAuthenticationCredentials
第一种方法是不重定向URL.浏览器已启动,仅此而已.
在第二种方法中,显示登录弹出窗口.但是它没有输入用户名和密码.当我在调试模式下运行脚本时,代码未到达driver.switchto().alert();
在gotoURL中只有它被击中.
我在Windows 10中使用IE11
在此处输入图片描述
In the first approach the url is not getting redirected. Browser is initiated and that's it.
In the second approach, the login popup is displayed. But its not entering the username and password. When I run the script in debug mode, the code is not reaching driver.switchto().alert();
In the gotoURL only its struck.
I am using IE11 in Windows 10
enter image description here
参考您的第一种选择,即在URL中传递凭据,此博客文章提供了一种解决方法:
Referring to your first option, namely passing the credentials in the URL, this blog post provides a way forward:
https://blog.ham1.co.uk/2016/03/05/selenium-allow-basic-auth-in-ie11/
-
您需要在注册表中创建以下节点:
You need to create the following nodes in the registry:
HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_HTTP_USERNAME_PASSWORD_DISABLE HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ Microsoft \ Internet 资源管理器\ MAIN \ FeatureControl \ FEATURE_HTTP_USERNAME_PASSWORD_DISABLE HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ Internet Explorer \ Main \ FeatureControl \ FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
为"iexplore.exe"和"explorer.exe"创建密钥
Create keys for "iexplore.exe" and "explorer.exe"
对于我来说,这绝对是二等奖,它偏离了实际用户与被测网站的交互方式.
it is definitely the second prize for me, it deviates from the way an actual user would have interacted with the site under test.
我还发现,Webdriver不再支持基本身份验证方法,它根本无法在Java上运行.它仍然可以在.net上运行,但只能在Win7-8.1上运行.
I have also found out that the Basic Authentication method is no longer supported by the Webdriver, it will not work on Java at all. It still works on .net, but only on Win7-8.1.