Sahi Pro - 401 Authentication

abstract This section describes how to handle 401 authentication with Sahi.

A 401 dialog may be used in authentication of websites.

On Internet Explorer, it looks like this:

On Chrome, it looks like this:

On Firefox, it looks like this:

However, when navigated to the same site, Sahi automatically transforms this modal dialog into a simple web page.

Since it is now just another HTML page, you can easily write scripts to enter username and password into the dialog.

info Sometimes the AuthKey may have something dynamic like a timestamp in it. In such cases, a regular expression can be used.
Eg. You can use /Secure/ instead of Secure Gateway in the AuthKey field above.
To accept for any AuthKey one can use /.*/.
Try setting AuthKey to /.*/ before troubleshooting further.

warning If the application needs username as domain\username, use domain\username.
In early versions of Java 1.7, using usernames of format domain\username can fail.
Upgrade to the latest Java 1.7 or revert to 1.6 and it should fix the issue. (java version "1.7.0" fails but "1.7.0_45" works correctly.)

To change the version of Java that Sahi Pro uses, edit sahi/userdata/bin/setjava.bat (or setjava.sh)
and modify
set SAHI_JAVA_HOME=C:\path\to\java1.7