Troubleshooting Page Loading or Rendering Problems
symptom
- AJAX pages do not render correctly when navigating through Sahi
- You get Javascript errors only when going through Sahi
cause
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.
resolution
- Just before loading the page through Sahi, click on "Enable Traffic Logs" link on the Dashboard.
- Then navigate to your page that causes the error. Once the page/error shows up, click on "Disable Traffic Logs" on the Dashboard.
- Click on the arrow near the "Enable Traffic Logs" and it should open up explorer at sahi/usedata/logs (If it does not open just go to that directory)
- Go to traffic folder
- You will see timestamped folders. Open the latest one, and look inside for various folders which represent individual URL calls made by Sahi. Inside those folders, you will see response.body_modified_xxx and response.body_unmodified_xxx. Open the modified one in a text editor and check if there is Sahi injected content in a non-html file.
- If there is, open the corresponding request.header_unmodified.txt file and get the full URL from the first line. It would look something like:
Add the URL or a pattern of it in exclude_inject.txt file.GET http://sahi.co.in/demo/clickCombo.htm HTTP/1.1
You can do this- by directly editing sahi/userdata/config/exclude_inject.txt
- Click on 'Configure' link on Dashboard
- open 'exclude_inject.txt'
- add the full URL or URL pattern
- click Save
- Restart Sahi, clear browser cache, and check.