Sahi supports HTTPS out of the box. Sahi Pro eases the pain by automatically accepting SSL certificates. Sahi ships with a root certificate and all other certificates will be signed by this root certificate, making SSL testing absolutely smooth.
But, for some reason if the browser reports a certificate error as shown below, then you will need to import the root certificate to the “Trusted Root Certificate Authorities” store.
To import the root certificate, click on the “SSL” link on dashboard.
Click “Yes” to import the certificate.
This should import the certificate successfully.
Once done, you should be able to access your HTTPS/SSL site.
<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 directoryFor eg. you could do
PATH=C:\Java\bin;%PATH%
start_sahi.bat
to add java\bin to the path before you start Sahi.
NOTE: It is possible that there are some domains/subdomains that are “hidden”. They may be used to fetch css, javascript and other artefacts. These certificates also need to be accepted via the SSLManager if your site has to work well. If your browser hangs, or the web page looks different than normal, or shows javascript errors, it may be because of these unaccepted certificates.
Follow the steps in these video for accepting SSL certificates on
Internet Explorer 8, 9
Internet Explorer 7 or before.
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.
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.