Create a dynamic Xpath with TestObject / Mobile


I’m using KS 7.8.2 / mobile application

I am trying to create a dynamic xpath using the TestObject class.
This is my code :

String myXpath = "(//*[(@resource-id = \'fr.myObject:id/retour_lib\' and @text = \'2004210154605 - 337 - FILLE\' or . = \'2004210154605 - 337 - FILLE\')]//following::android.widget.TextView[@resource-id=\'fr.myObject:id/case_more\'])[1]"

TestObject myNewObject = new TestObject ('CLIC_PLUS')
myNewObject.setSelectorValue (SelectorMethod.XPATH, myXpath)
myNewObject.setSelectorMethod (SelectorMethod.XPATH)
Mobile.tap (myNewObject, 1, FailureHandling.OPTIONAL)

When i run i have no error (or no warning) but it doesn’t click on the right object …
If I put exactly the same Xpath string directly in the object repository with the Xpath method then it finds it correctly and clics on the right object.

What am I doing wrong?

Thank you