Roy K
Roy K

Reputation: 3319

UIAutomation using command line doesn't work

This is the code I execute in the terminal:

instruments -w 'afb79e6f07256ff94c8d5a11e4db6c26950e2b2d' \
    -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
    'TestAutomation.app' \
    -e UIASCRIPT '/Users/roykronenfeld/Desktop/Automation.js' \
    -e UIARESULTSPATH '/Users/roykronenfeld/Desktop/' 

The error I get:

Instruments Usage Error : Specified target process is invalid:
/var/mobile/Applications/51EA888D-9D16-4F7B-919F-68F9C56F0585/TestAutomation.app

Which obviously says that the path to the app is incorrect. However, I'm not sure how come it's incorrect if I pulled that app path from the Xcode using following code:

NSString *Directory = [[NSBundle mainBundle] resourcePath];

Any ideas?

p.s: the app is already installed on the device.

Upvotes: 2

Views: 1288

Answers (2)

Ricardo B.
Ricardo B.

Reputation: 189

You can also use the "Bundle Identifier"

Upvotes: 0

Roy K
Roy K

Reputation: 3319

Here is the way it works:

instruments -w 'fa10dec83c62a571a9691b5d9ef24cc68de73bf0' \
    -t '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate' \
     TestAutomation \
    -e UIASCRIPT '/Users/roykronenfeld/Desktop/Automation.js' \
    -e UIARESULTSPATH '/Users/roykronenfeld/Desktop‘ 

Note how the app name does not have '' and .app at the end as when doing automation on device via command line all you need to provide is the app name.

Upvotes: 2

Related Questions