Skip to content
Get Free Trial

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 not 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 test run happens on the iPad, to check if the web app renders correctly on iPad or not.

With these points in mind, let us move ahead and configure our iPad for the run. While following these steps, use the IP address of the machine on which Sahi is running

  1. To start configuring the iPad, click on the settings icon on the home screen.

    iPad Settings

  2. This will open the general settings option panel. Click on the network tab:

    iPad Settings

  3. 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.

    iPad Settings

  4. 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.

    iPad Settings

  5. 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.

    iPad Settings

  6. Set the proxy to the IP address of your machine. Look here for instructions on how to get the IP address of your system.

    iPad Settings

  7. Also set the port to 9999. This will ensure that it is going to route through Sahi installed and running on the machine.

    iPad Settings

  8. Configure Safari to accept cookies always:

    • In Safari 5.1 or later:

      Safari -> Preferences -> Privacy -> Select “Never” under “Block Cookies”

    • In Safari 5.0 or earlier:

      Safari -> Preferences -> Security -> Select “Always” under “Accept Cookies”

  9. Open Safari and go to http://<your machine's IP>:9999, such as http://192.168.1.70:9999. The Sahi Pro start page opens.

  10. In Run a Script, choose the File to run [1], enter the Start URL [2] and tap Run [3]:

    Run a Script on the Sahi Pro start page at iPad size, with Script Directory C:/SahiPro/userdata/scripts/, File sahitests/codecoverage_test.sah, Start URL https://sahitest.com/ and the Run button; numbered badges mark File, Start URL and Run
  11. Safari opens the start URL and the test runs.

The test’s report is in Reports on the machine that runs Sahi Pro.