Reputation: 962
I have an image within a collection view that I am unable to click on. Appium can find the element fine but using the is_displayed()
function always returns false. I read up on the iOS Class chain function so attempted to use that to click on the images parent XCUIElementTypeCell
(Which can be clicked on, but has no label, or name value annoyingly)
My attempt:
self._driver.find_element(By.IOS_CLASS_CHAIN, "**/XCUIElementTypeImage[`name BEGINSWITH \"Click Me\"`]/**/XCUIElementTypeOther/**/XCUIElementTypeCell")
This gives a NoSuchElementException
The app structure looks like this:
So that XCUIElementTypeImage
in the centre is what I am trying to target using name which equals "click me" in this example. The parent XCUIElementTypeOther
also can be found but is not clickable so the only solution for me is jump up two levels to the XCUIElementTypeCell
P.S Please no Xpath suggestions
P.S2 Thanks for the help
Upvotes: 0
Views: 4921
Reputation: 1
Try the following:
"**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"
OR
"**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"
Upvotes: 0