This is with Robot Framework running with Appium version 1.5.04 on an Android physical device with the device context set to NATIVE_APP
Steps to reproduce: using an xpath relationship where the element we want (a button) is a child of a View where there are multiple Views entities at the same level
The derived xpath: xpath= //[@class='android.widget.Button' and ./parent::[(./preceding-sibling::* | ./following-sibling::*)[contains(@contentDescription,'Sticky')]]]
This xpath is intended to act on a Button that is a child of a View element that contains the name 'Sticky'
What I'm finding is that the following Click Element keyword works fine (both finds and clicks the element)
e.g.:
Wait Until Keyword Succeeds 5x 3 sec Click Element xpath= //*[@class='android.widget.Button' and ./parent::*[(./preceding-sibling::* | ./following-sibling::*)[contains(@contentDescription,'Sticky')]]]
However, any of the conditional keywords, e.g.: (I don't always want to click the element, just see if its there or not there)
Element Should Be Visible xpath= //*[@class='android.widget.Button' and ./parent::*[(./preceding-sibling::* | ./following-sibling::*)[contains(@contentDescription,'Sticky')]]]
(same xpath used)
Gives an error: ValueError: Element locator with prefix '//*[@class' is not supported
I've tried other element values (e.g. ContentDescription) with the same result. This particular element unfortunately does not have an assigned id.
Is there different xpath syntax that I should be using or a different keyword that would be better suited?