In my quest to develop an iOS UI Automation javascript with Instruments for automating the process of taking a screenshot in my iOS app, I have turned to the handy tool known as Snapshot.
A crucial part of my app involves a webview, and I am keen on capturing a fully rendered screenshot of this webview before progressing with the script. The current script I have looks like this:
var target = UIATarget.localTarget();
target.frontMostApp().mainWindow().scrollViews()[0].webViews()[0].links()[0].tap();
// take screen shot here
target.frontMostApp().navigationBar().leftButton().tap();
However, when the screenshot is captured, the webview is not fully loaded, resulting in an empty screen and a return to the main screen. Is there a method to ensure that the webview is fully loaded before taking the screenshot and continuing with the rest of the script?