Run internet explorer as different user using Selenium

邮差的信 提交于 2019-12-22 01:36:22

问题


I want to launch single Internet explorer instane as different user with Selenium. I referred to the following post but not getting anywhere.

How can I run Internet Explorer Selenium tests as a specific domain user?

Can you point me in the right direction how it can be achieved?


回答1:


You can achieve that using URI authentication. For Google Chrome that behavior works without any additional changes, but for IE it blocked by default. You can unlock it by:

Set the DWORD value's value data to 1 in one of the following registry keys.

  • For all users of the program, set the value in the following registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Internet
    Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
  • For the current user of the program only, set the value in the
    following registry key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE

After that you will be able to use next URI to achieve your needs: http://username:password@host/ If you want to provide domain name, you need encode that like http://domain%5Cusername:password@host/

Source https://support.microsoft.com/en-us/kb/834489



来源:https://stackoverflow.com/questions/28847989/run-internet-explorer-as-different-user-using-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!