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)
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.
This helps in my understanding. It appears that this is only supported for Android devices at API level 18 and up. So, that is certainly an important consideration if you need to test an app that supports API levels 15 - 19 (our use case).
Oh indeed! I forgot that the option isn’t even relevant in API levels <18. Good news for you is that it’s always off by default now In times past, there were a couple versions of appium where it we set that option.