There are various Automation tools available in the market and open source tools have this upper hand over the licensed ones because there is always an extra investment needed to buy the commercial product. If the goal is achieved with an open source tool and is reliable then why to go for a licensed one? Here I am going to discuss about a new open source Automation tool “Sahi”.
“Sahi is a mature, business-ready tool for automation of web application testing. Sahi is available as an Open Source free product and as Sahi Pro, the commercial version. For testing teams in product companies and captive IT units which need rapid reliable web automation, Sahi would be the best choice among web automation tools.”
Sahi is mainly used to do cross browser compatibility testing. Cross browser compatibility testing is nothing but to make sure the application is working properly across various browser platforms. Let’s see how do we configure Sahi in our local system. Step 1 – “Download the Sahi Open Source tool”:- Download Sahi Open source tool source zipped file from the following location:- http://sourceforge.net/projects/sahi/files/sahi-v44/ Step 2 – “Extract the files in the local system”:- Once downloaded, extract it to a folder in your local system (say “D:\Sahi\”). Step 3 – “Configure the installation path on every browser”:- After extraction, we can see the default folder structure under “D:\Sahi” as shown below:-
Under <home_dir>/userdata/config, there is a file “browser_types.xml”. I need to edit this file mainly to set the correct <path> of browser installed in my system. As of now ignore the remaining fields. Since this is the default file, I can either comment out or delete the browser tags for the browsers not installed in my system as shown below:-
Step 4 – “Configure browser proxy settings on every browser”:- Since Sahi runs on proxy port 9999, I need to configure the following proxy host and port on all the browsers in which I need to execute the test. Http Proxy/Address as “localhost” Http Port as “9999” Change proxy settings in IE – http://windows.microsoft.com/en-IN/windows-vista/Change-proxy-settings-in-Internet-Explorer Change proxy settings in Chrome – http://www.googlechrometutorial.com/google-chrome-advanced-settings/Google-chrome-proxy-settings.html Change proxy settings in Firefox – http://www.wikihow.com/Enter-Proxy-Settings-in-Firefox Note: – In case you have other browsers installed in your system, you can change the proxy settings for them as well. Step 5 – “Start the Sahi proxy server that listens to port “9999”:- In the folder structure shown above, under <home_dir>/bin, there is a file “Sahi.bat”. I will be executing this file to start the server as shown below:-
Once the proxy server is started, you can see in the above snapshot that it reads the browsers from the browser_types.xml file and listens to port 9999. Note: – In case if you get any error after you execute Sahi.bat file, you need to debug if there is an incorrect path specified in any of the configuration files. Step 6 – “Open the browser and invoke Sahi Controller”:- After the proxy server is started, open the browser in which proxy host and port has been set and press “Ctrl+Alt+DblClick” to invoke Sahi Controller. Below is the snapshot of Sahi Controller:-
Once the Sahi Controller is opened, we can start doing record/play using the tool. I will be mentioning the working of Sahi in my next blog.
Is there any option to control the speed of playback tests?
Yes there is a way to set the speed of playback tests. Please find below the steps:-
import net.sf.sahi.client.Browser;
public class
{
Browser browser;
browser.setSpeed(6000);
// code
}
Try executing the above set of statements. This should work
However proper library (jar) files needs to be added in Lib folder (if required).
Hey Sohit good post … Similarly I started my blog as well where I posted some post related to Sahi. Please check on http://abhijeetthalkari.wordpress.com And let me know your feedback as well.
Hi, i have installed SAHI, and in Dashboard, the browsers which is installed in my system(IE and Chrome) is not displaying and am getting “No Usable browsers found in browser_types.xml” message. Plase advice how to setup the browser.
Hi Vijayalakshmi,
Under/userdata/config, you can find the configuration file “browser_types.xml”. You need to edit this file to set the correct of browser installed in your system. This is the config xml Sahi reads at the time of execution.
Can Sahi test Angular applications as well?
Hi Sohit,
I’m using Sahi pro on both a windows server machine and a local machine. The same scripts successfully able to work on my local machine, are actually failing on the Windows server machine because in some cases sahi_pro is not able to find the buttons. Did u experience a problem like that ?
Thanks,
G.