MobileSafari on real iOS Device

This is more of a question and a request.

Does WPT currently support MobileSafari (Not UIWebView)? I see there is an openURL xcode project under the nodejs agent.

How do I get this up and running? The agent setup does not talk about iOS in as much detail as it does with Android.

Not officially, the code is still in development and has a fair number of rough edges (though it does work). As it stands right now, you need:

  • A jailbroken phone (to clear the cache)
  • A linux or Mac machine to drive the phone
  • The iOS/Chrome dev tools bridge up and running:
  • The openUrl app built and installed on the phone
  • Possibly some other stuff - I haven’t tried it myself yet

We were working on both iOS and Android in parallel but stopped iOS work for a while when kitkat launched with screenrecord (giving us a good way to capture video on Android) so we could launch the Android agent. It will probably be a few months before we get back to working on the iOS agent though there is a lot of interest in it (help is always welcome).

The main things that I think we want to do are:

  • Eliminate the jailbreak requirement (see if webkit has a cache clear command that actually works, the normal chrome command doesn’t)
  • Replace the openURL project with something off the shelf that can launch safari (maybe something in libimobiledevice)

Video capture is likely to be an ongoing problem for iOS and it’s critical for a lot of the visual metrics - would be great if that space improved as well.

Thanks for the detailed response, Patrick!

Do you know how Appurify runs their tests on MobileSafari? I assume when they mention “iPhone5S,” they are running on a real device not simply a simulator. It seems they are able to open a private browsing tab to do away with the clear cache requirement. The result here for example has the darker private UI on Safari. Is this because the device might be jailbroken - so they are able to fire up automation to tap on the private button?

Is there something with UIAutomation that we can use to automate clicking on the Settings UI for clearing browser cache? It seems that apps need to built signed with the development identity - which won’t be the case for MobileSafari or Settings.

I am working on website testing on RealDevice/MobileSafari on my end as well. So far, I have been able to connect successfully into a Safari tab via the debug proxy and retrieve HAR data from it. There is a neat little library chrome-har-capturer that basically does away with the specifics of calling into the dev tools console.

For video, I have been looking into the AirPlay Display mirroring protocol. It seems the community has a pretty good reverse engineered specification of the protocol. There are no open source receivers unfortunately. But there are a few commercial solutions that allow video capture of the mirrored display. So this looks definitely doable.

Yes, they run on real devices with the native browser. I don’t know the details of their implementation but they have a lot of custom code to drive the browser as well as a bunch of software on the phone (including their own on-device video capture). They do it without needing to jailbreak. Yes, I think they use in-private to prevent caching which would be interesting but I’d really love to do it with the regular code path if possible.

Airplay will probably work ok for a limited number of devices - my main concern is with running the data and video signal in the same wifi frequencies and running out of bandwidth.

One thing I wanted to look at was if Safari desktop connected to a phone could clear the cache which would be a good sign that it’s possible, just with a different command.

I tried firing up UIAutomation on to attempt to open a private tab. I reached a dead end when it complained that the app needs to be signed by a developer identity. Are you aware of any other way to drive automation into the native bits of without jailbreak? My next step is to look into libimobiledevice/ideviceinstaller to see if it can dump out the existing which I can then try to sign using my own identity. But that is very much a longshot.

I looked into the Desktop Safari web inspector to try to clear cache from remote. There doesn’t seem to be any obvious way in the UI. Desktop Safari does have UI to disable caching. But this does not seem to propagate into the remote browser instance.

One very roundabout way, I found that restoring the device from a previous backup - one with empty browser data seems to achieve the effect of clearing the browser data. I am looking into whether I can specifically restore only Safari’s app data - since the whole restore takes a few minutes.

Sorry, you’re in uncharted territory for me. I do agree that a restore isn’t desirable, slows down the testing rate too much.