Basic authentication with Selenium in Internet Exp

2020-02-01 02:03发布

One of our webapplications is using Basic Authentication and build with AngularJS. To test this application, I use Protractor, which uses Selenium to communicate with browsers.

In Chrome, everything works fine and doing basic authentication is easy:

username:password@host.ext

Under Internet Explorer, the URL's with password and username are expected to be a security risk and are therefor not allowed. Until Internet Explorer 9, this setting could be turned off in the registry (FEATURE_HTTP_USERNAME_PASSWORD_DISABLE). When setting this registry key for Internet Explorer 10, the behaviour changes (no error is displayed and the URL gets rewritten without the username and password) but the feature looks broken. Internet Explorer 11 shows the same behaviour as Internet Explorer 10 does.

Does anyone have a different workaround to bypass this problem?

1条回答
一夜七次
2楼-- · 2020-02-01 02:45

My upgrade to Internet Explorer 10 was also an upgrade to a 64-bit Internet Explorer. And for some reason, 64-bit variants use another register key:

HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Internet Explorer/MAIN/FeatureControl/FEATURE_HTTP_USERNAME_PASSWORD_DISABLE

Setting a DWORD iexplore.exe with value 0 in this registry key fixes the issue.

The 64-bit variant is also very slow, and switching back to 32-bit is a good choice to fix this slowness. The 64-bit variant of IE is only used with the 64-bit variant of IEDriverServer.exe. Using IEDriverServer.exe 32-bit let you switch back to IE 32-bit.

To be complete, the register key for 32-bit is:

HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Internet Explorer/MAIN/FeatureControl/FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
查看更多
登录 后发表回答