appium/appium — pull request #1244 by snevesbarros (2013-09-30 12:10:16+00:00)
Title: Running tests Safari using the SafariLauncher app

This solution allows you to run tests against safari without any delay using the SafariLauncher app.

It catches the instruments connection timeout (decreased to speed up test execution) and returns an all OK, which allows the test to continue. When stopping the test it closes the remote debugger connection and cleans up.

I was able to run multiple consecutive tests using safari without any issues and quite speedy as well ;).

Steps:
1. Clone the SafariLauncher App and change the delay to be 0.
2. Deploy the app to your device and take a reference to the app in derived data (and set that as app).
3. The code looks for this app and has certain catches in place (e.g. when instruments times out)
4. Write a script that launches the app (which then launches safari) and in the second step just switch to the web view and your off.

Note: safari is left open after the test. Anyway of closing it? I tried javascript "window.close()" but that didn't work. You can however clear all cookies to clear the previous session.