Tried running with xcode 6, complains about the tracetemplate path
WebDriverException: Message: u'A new session could not be created. (Original error: Could not find Automation.tracetemplate in /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate)
Fix the Instruments path. They changed the .bundle folder to .xrplugin
ln -sf /Applications/Xcode6-Beta2.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/ /Applications/Xcode6-Beta2.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle
Match the directory structure of Xcode 5
mkdir /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
mkdir /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
Fix the simulator app name. They changed it from iPhone Simulator to iOS Simulator (about time)
ln -sf /Applications/Xcode6-Beta2.app/Contents/Developer/Applications/iOS\ Simulator.app /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
Fix the binary name. They changed it from iPhone Simulator to iOS Simulator (about time)
ln -sf /Applications/Xcode6-Beta2.app/Contents/Developer/Applications/iOS\ Simulator.app/Contents/MacOS/iOS\ Simulator /Applications/Xcode6-Beta2.app/Contents/Developer/Applications/iOS\ Simulator.app/Contents/MacOS/iPhone\ Simulator
In reply to @James_Farrier and @rstagner
Yes this should fix xpath issues!
xpath compression in android now defaults to false
, so all views are included in xpath searches. It can slow things down a bit, so advanced users can set ignoreUnimportantViews
to true
for most tests, and switch it to false
for tests which require xpath to get elements which Android marks as non-important.
Thanks for the reply. When you refer to xpath compression, I think I know what you mean, but could you provide an example of that so that I'm clear about it's purpose?
Ok, I'll give it a try.
Android UiAutomator has a method called setCompressedLayoutHierarchy:
/**
* Enables or disables layout hierarchy compression.
*
* If compression is enabled, the layout hierarchy derived from the Acessibility
* framework will only contain nodes that are important for uiautomator
* testing. Any unnecessary surrounding layout nodes that make viewing
* and searching the hierarchy inefficient are removed.
*
* @param compressed true to enable compression; else, false to disable
* @since API Level 18
*/
public void setCompressedLayoutHeirarchy(boolean compressed) {
getAutomatorBridge().setCompressedLayoutHierarchy(compressed);
}
So.... when that is set, every single UiAutomator command runs on a subset of all the views that are actually present. That makes lookups and traversals of the layout hierarchy faster, since there's less elements to check on every operation.
I opened up the Android ApiDemos app and called getSource()
. Then I set ignoreUnimportantElements
to true
and ran it again.
See how less is returned when the layout is compressed? A bunch of nested FrameLayout and LinearLayout views were removed since they don't seem to actually contain anything important.
Things will run faster, but if you wanted to query the hierarchy for one of the "dropped" views, appium wouldn't see it, or xpath might grab the wrong element instead. That's why it's disabled by default. I would try enabling it and see what fails.