Tutorial
June 3, 2013

Run Sahi script on iPad

Sahi can be used for testing the fluid nature of web apps and its functionality on different devices. In this post, we will be looking into running Sahi scripts on iPad. Before I go ahead and mention how to do this, there are few important notes about this kind of execution:

  1. You can't install Sahi on iPad. Sahi must be installed and running on a different computer in the same network.
  2. The scripts which will be executed on iPad will not be recorded on the iPad. These scripts will be recorded on the computer itself, by resizing the browser and changing the user agent to iPad.
  3. Only the playback will be done on the iPad to check if the web app renders correctly on iPad or not.
  4. The scope of this post is only related to playing back a script on iPad. A different post will come up with the steps required to record scripts for different devices.

With these points in mind, let's move ahead and configure our iPad for the run. While following these steps, please note that you need to use the IP address of the machine on which Sahi is running (and not the IP I am using, that is of my own machine).

  • To start configuring the iPad, click on the settings icon on the home screen.
1
  • This will open the general settings option panel. Click on the network tab:
1
  • This will show all the network options that are present for connection. In the wi-fi settings click on the network that is being used by both the iPad and the machine running Sahi. I am using Tyto_24 so I will click on the arrow button next to it.
1
  • This will open the settings for that particular network and show a bunch of details about the network. What we are interested is the proxy for the network. In case you are within another proxy, such as your corporate proxy, you need to make changes in the Sahi installed in your machine. Let us click on the manual button of proxy.
1
  • This opens up the settings panel for the proxy. The two fields which we are interested in are the proxy and port. We need to set these ports to our computer running Sahi on port 9999 so that the iPad can use the Sahi on the machine to run the scripts.
1
  • Set the proxy to the IP address of your machine.
1
  • Also set the port to 9999. This will ensure that it is going to route through Sahi installed and running on the machine.
1
  • Configure Safari to accept cookies always:Settings -> Safari -> Accept Cookies = Always
  • Now open a Safari browser and go to the URL http://192.168.1.70:9999. Replace the IP with your own machine IP. This will open the Sahi page for running script on mobile. This is similar to the playback tab of the controller where you can provide the script name and start URL for the run.
1
  • Provide the name of the script at [1], the start URL at [2] and then click the run button [3].
1
  • As you click the run button, you can see the page navigating away to your script run and your script will be executed now.
1

The reports for this script will be available on the machine on which Sahi is running.

Continue reading