Forum Discussion

KyleMit's avatar
KyleMit
New Contributor
11 years ago

BrowserInfo.Run takes a long time when prompted for credentials with HTTP 401 Challenge

The website we're testing requires a login on first access, so any unauthenticated users are immediately presented with an HTTP 401 Challange, instead of a HTTP 200 Success Page. However, when ...
  • HKosova's avatar
    11 years ago
    Hi Kyle,



    How can I resume execution of a script when the server successfully sends any response requesting credentials?


    Possible solutions depend on your tested website and your test case.



    If your application uses Basic authentication, you can pass the login and password in the URL - this avoids the login prompt:

    Browsers.Item(btIExplorer).Run("http://username:password@www.example.com/path");
    Note: For this to work in Internet Explorer 7+, create the iexplore.exe DWORD value in one of the following registry keys, and set it to 0:

    * For all users:

       HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE

    * For the current user only:

       HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE

    (Source: Microsoft KB article 834489)



    If your test case requires entering the login information manually, you can navigate to your website in a way other than .Run(url). For example, you can pass the URL as a command-line argument to the browser:



    var browserInfo = Browsers.Item(btIExplorer);

    browserInfo.RunOptions = "http://example.com";

    browserInfo.Run();

    In this case, the test run continues without waiting for the page to load.