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

401 authentication looping or does not login even if the credentials were valid

There are some applications which supports only the Negotiate with NTLMSSP scheme. In this case, the login prompt loops even if the credentials were valid.

To solve this looping issue, add the following property in the userdata.properties file:

curlconnection.enabled=true
info

NOTE: Make sure the AuthKey field in the login prompt is any or /.*/ when the above property is enabled.

warning

Error on console: "Falling back! The curljava JNI library cannot be loaded"

WARNING: Falling back! The curljava JNI library cannot be loaded

If you are getting the above error from the console, Install the Visual C++ 2013 x86/x64 runtime on your computer.

Visual C++ 2013 Runtime components download: https://www.microsoft.com/en-in/download/details.aspx?id=40784