UIASCRIPT:
var result = UIATarget.localTarget().host().performTaskWithPathArgumentsTimeout("/usr/bin/open", ["/Applications/Safari.app", "http://www.google.com"], 30);
UIATarget.captureScreenWithName('test.png');
command line:
instruments -t /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate Safari.app -e UIASCRIPT cap.js
what’s wrong with my approach? thanks!
The problem is you called captureScreenWithName method on UIATarget class instead of target object.
It should be:
UIATarget.localTarget().captureScreenWithName('test.png');Note: Same for captureRectWithName.