| Share
  1. Explore
    Introduction, screen-shots, features, limitations
  2. Getting started
    Prerequisites, download, install, browser configuration, record, playback, view logs
  3. Sahi Scripting Basics - I
    Statements, variables, functions, conditions and looping, _include
  4. Sahi Scripting Basics - II
  5. Sahi APIs (built-in functions)
    1. Browser Accessor APIs
    2. Browser Action APIs
    3. Miscellaneous APIs
  6. Sahi Scripting - Calling Java
  7. Exception handling using try-catch
  8. Recovering without try-catch using _setRecovery
  9. Data Driven Testing
    _getDB, CSV Files, Excel, Databases
  10. Multithreaded Playback (Parallel execution)
    suites, commandline, ant
  11. Advanced techniques, tips and examples
    1. HTTPS/SSL Sites
    2. Configuring an External proxy
    3. Adding jars to Sahi's classpath
  12. Other language drivers Driving Sahi from Java, Ruby etc.
    1. Java
    2. Ruby

HTTPS/SSL sites ·

Sahi supports HTTPS out of the box.

  • Make sure that your browser is using Sahi as its proxy for “Secure” or “SSL Proxy” too.
  • Look at “Is keytool available” under “Java” section on the “Info” tab of the Controller. If you are unable to get the Controller up on an HTTPS site, go to an HTTP site and bring up the Controller.
  • If “Is keytool available” is false, add <java>/bin to your PATH variable. (Details on adding Java/bin to Path), or specify the full path to keytool.exe in <sahi>/config/sahi.properties. keytool.exe is present in the <java_home>/bin directory

For eg. you could do

PATH=C:\Java\bin;%PATH% start_sahi.bat

to add java\bin to the path before you start Sahi.

Sahi Controller - Recorder tab

  • Navigate to the HTTPS site. If the above instructions have been followed, you will get a page which warns you that the certifcate is incorrect. On Firefox , click on “Add Exception” and then “Confirm Security Exception”. The web site will then be displayed.

  • At this point, the website which has been displayed may not work properly if it fetches css and javascript files from another https domain or sub-domain. The Controller will also not come up with ALT-DblClick.

Sahi Controller - Recorder tab

  • You will now see a list of domains that Sahi has created certificates for. Some of them will be red and some green. Click on the red ones, and you will get the same certificate dialog which you would need to accept. Once you have accepted the required certificates on the browser, you should be able to navigate properly to the web page. Here is a video of accepting SSL certificates on Internet Explorer

HTTPS sites hang during record or playback (OLD – for Forefox 2 only)

This may happen if there are multiple certificate dialogs being opened by the browser at the same time. When trying to automate HTTPS sites, first do a dry pass of the site with the proxy on, but without bringing up the controller. Only bring up the controller for record/playback after all certificates have been accepted. This used to happen on Firefox 2.


Creating certificates manually:

NOTE: YOU SHOULD NOT HAVE TO DO THIS ANYMORE. JUST FOLLOW THE FIRST TWO SECTIONS AND THINGS SHOULD WORK PROPERLY.

If the certificates do not get created in sahi/userdata/certs folder, you can follow these instructions to manually create the certificates. These instructions will appear on the Sahi proxy console if there was some problem in creating certificates.

——————————HTTPS/SSL START——————————

Sahi is trying to create a certificate for domain:
sahi.example.com
If you are unable to connect to this https site, do the following:
Check on your filesystem to see if a file like
<sahi_dir>\certs\sahi_example_com
has been created.
If not, then create it by running the command below on a command prompt.
Note that you need ‘keytool’ to be in your path.
keytool comes with the JDK by default and is present in <JAVA_HOME>/bin.
Once you create that file, ssl/https should work properly for that site.

———-COMMAND START———-

keytool -genkey -alias sahi.example.com -keypass sahipassword -storepass sahipassword -keyalg RSA -keystore D:\sahitest\sahi\certs\sahi_example_com -dname "CN=sahi.example.com, OU=Sahi, O=Sahi, L=Bangalore, S=Karnataka, C=IN"

———-COMMAND END———-

The files in certs can be copied over to other systems to make ssl/https work there.

——————————HTTPS/SSL END——————————

NOTE

Since 2008, we changed the dummy domain name that sahi uses to sahi.example.com. If SSL used to work properly but has now started becoming slow, clear the files in <sahi_dir>/certs directory, and let Sahi make new ones again, by accessing those sites.

Some trivia about example.com domains.




---