You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mark Watson edited this page Sep 14, 2016
·
1 revision
When a page requires HTTP authentication (when the browsers displays a Basic/Digest/NTLM login dialog), you can set the username and password ahead of time, so that dialog is bypassed. Authentication still happens as it would if you manually typed in the username / password, with the initial request coming back with a 401 status code and then the browser making a follow up request with the 'Authentication' header set.
// Open the browser, but don't go to the page until we set the username / passwordvarb=pizza.open();// Set username and password to be used for HTTP Authentication// This will work with both Basic and Digest HTTP Authenticationb.setAuth("httpwatch",utils.randomString());// Go to a page that requires authenticationb.open("http://www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx");