Reputation: 83
The task of updating an automation framework has fallen upon me. I'm new to iOS testing so I'm having trouble with the new XCUITEST driver in Appium-1.6.0-beta1.
I have the driver up and running, but the majority of elements are located using xpaths in the framework (not at all ideal I know) the majority of elements do not have labels, names, or accessibility tags. Thus :name locators are ruled out for 90% of elements at the moment.
The xpaths seem to be catering to the old apple framework (UIAutomation) and look like the following:
//UIAApplication[1]/UIAWindow[4]/UIAAlert[1]
I have tried soemthing like this:
//XCUIApplication[1]/XCUIElementTypeWindow[4]/XCUIElementTypeAlert[1]
These are passed into driver.find_element(:xpath, xpath_value)
With no luck. I can't seem to find any documentation on this, and have had minimal success on the appium discussion forum.
Can anyone point me to a working example, or documentation? Any better way to do this?
Any input would really help!
Thanks, Peter
Upvotes: 2
Views: 5416
Reputation: 1
The above answer by JaysonP works fine but there still is a way to use the appium inspector.
Upvotes: 0
Reputation: 1251
With little workaround, you can use the old graphical appium to find xpath of view elements for using with Appium v1.6 Follow the step 1 in this link on medium: The good old Appium inspector, with a bit workaround
Upvotes: 0
Reputation: 149
Not all of the XCUI elements are direct transfers from UIAutomator. The way I have been using is to run the tests without the xpaths you need and when you open onto the screen you desire go:
System.out.println(driver.getPageSource());
Then it is a matter of reading that XML to get the desired item. A lot more tedious but without the appium inspector in 1.6BetaX it's the only way I know how to get the XCUI hierarchy.
Upvotes: 3