无法使用Selenium WebDriver在IE 11中输入用户名和密码

编程入门 行业动态 更新时间:2024-10-27 12:35:28
本文介绍了无法使用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中传递用户名和密码,即 Uname:pwd@url 2)使用alert和setAuthenticationCredentials

1) Pass username and password in the URL ie) Uname:pwd@url 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:

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上运行.它仍然可以在上运行,但只能在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 , but only on Win7-8.1.

  • 更多推荐

    无法使用Selenium WebDriver在IE 11中输入用户名和密码

    本文发布于:2023-11-27 23:01:57,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1639969.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:输入用户名   密码   Selenium   WebDriver

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!