KyleMit
11 years agoNew Contributor
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 calling the Run Function:
browser.Run("url")
the script pauses for a very long time because it is waiting for the full page to be returned. Once the navigation action times out, then the rest of the script executes and is able to provide the credentials using Aliases.browser.dlgWindowsSecurity.Windows_Security like normal.
This technically works, but at a very high cost for script execution time.
Is there a way to continue running the script as soon as any response is sent from the webpage?
However, when calling the Run Function:
browser.Run("url")
the script pauses for a very long time because it is waiting for the full page to be returned. Once the navigation action times out, then the rest of the script executes and is able to provide the credentials using Aliases.browser.dlgWindowsSecurity.Windows_Security like normal.
This technically works, but at a very high cost for script execution time.
Is there a way to continue running the script as soon as any response is sent from the webpage?
- 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:
In this case, the test run continues without waiting for the page to load.
var browserInfo = Browsers.Item(btIExplorer);
browserInfo.RunOptions = "http://example.com";
browserInfo.Run();