Open sahi/userdata/config/browser_types.xml . The paths of the browsers should match the browser location on your machine. If you have a custom browser which is not available there, you can add your own too. ( More info on browser types )
Sahi controls the browser by injecting javascript into web pages. However there are various requests like XMLHttpRequests, javascript, css, etc. where Sahi should not inject its code. While this is correctly detected and handled in most cases, there are instances where one may need to explicitly ask Sahi not to inject code. In such instances, regular expression patterns can be added to exclude_inject.txt. When a URL matches this pattern, Sahi will NOT inject its code.
For example while using ExtJS, Add
.*callback=.*
at the end of sahi/userdata/config/exclude_inject.txt,
restart Sahi, clear browser cache, and it should fix problems with AJAX and extjs.
You could determine the URL patterns using Firebug on Firefox, or using the Developer Tools on Internet Explorer. If neither of these works for you, enable traffic logging in Sahi and look at the various request responses.
1) Open sahi/userdata/config/userdata.properties
2) Add (or edit if already present)
debug.traffic.log.unmodified=true
debug.traffic.log.modified=true
3) Restart Sahi.
All traffic will be written to userdata/logs/traffic folder organized by date.
NOTE: RESET TRAFFIC LOGGING TO FALSE once you are done, or else the logs will quickly fill your hard disk.
Look at response.body_unmodified_xxx and response.body_modified_xxx to see if Sahi has injected code into the file. If yes, add the URL pattern to exclude_inject.txt
Note that the pattern needs to be a proper regular expression which will match the whole url. If your url is http://myapp/myajaxrequests.jsp?action=add, your regex may look like .*myajaxrequests[.]jsp.*
To explain, . (dot) means any character, *(asterisk) means any number of times, a literal . needs to be escaped by putting in square brackets. So the previous means, any character any number of times, then “myajaxrequests”, then a literal . (dot), then “jsp” and again any character any number of times)
Have a look at: http://sahi.co.in/w/https-ssl
(This also needs to be done for data cards like Tata Photon, Reliance etc.)
Sahi sets the IE LAN proxy settings to localhost 9999 automatically. When going through a VPN, you do not use the LAN, so Sahi’s settings would not work. To fix this you need to
1) Manually configure IE to use Sahi for the VPN connection
2) Optionally, tell Sahi to not change the LAN settings (optional: do this only if you will never use LAN)
To accomplish this, please follow the instructions below:
1) On IE, go to Tools -> Internet Options -> Connections -> Dial-up and Virtual Private Network Settings. There choose your VPN, and click on “Settings” button near it. Set localhost 9999 for HTTP and Secure.
Now Sahi should work correctly over your VPN.
2) (Optional, do this only if you will never use LAN) Open browser_types.xml from the Configure link on dashboard, and remove
<useSystemProxy>true</useSystemProxy>
line from Internet Explorer settings (You can remove it where ever it is present.)
Save, restart Sahi, and now Sahi will not try to change proxy settings of your system.
Do a “view source” on the page and search for “document.domain”. You may see something like:
document.domain = "maindomain.com"
This is done by the application developer, so that two frames/iframes from domains like a.maindomain.com and b.maindomain.com can communicate with each other via javascript.
To make Sahi work correctly with this, open sahi/userdata/config/domainfix.txt and add
*.maindomain.com maindomain.com
Save, restart Sahi, and now the Controller should work correctly.
Sahi waits on AJAX requests to make sure they are complete, before proceeding with playback. Some sites keep some AJAX requests open so that they can continuously poll for data. This causes Sahi to indefinitely wait for those requests to complete.
To fix this:
1) Open sahi/userdata/config/userdata.properties
2) Add (or edit)
xhr.wait_ready_states=2,3
3) Save the file, and restart Sahi
This should fix the issue.