I am automating the flow of iOS app made using react native.
I am able to find elements by XPath normally but when trying the ends-with syntax, it is unable to find the element.
I am using python language, below is the example of code snippet I am using:
self.driver.find_element_by_xpath("//XCUIElementTypeOther[ends-with(@name, 'locatorValue')]")
I tried to find the solution or example syntax to check if I am doing something wrong, but most of the times I was getting examples of Android only and also the syntax which I am using seems to be proper to me as per my understanding.
Is it a limitation that I can't use ends-with xpath for iOS app made using react native, or am I missing something here?
Kindly request to help me out.
You could simply use iOS NSPredicate expression like,
self.driver.find_element_by_ios_predicate("name ENDSWITH 'locatorValue'")
This should work for you.
To know more about iOS predicates, check here.