You can create your TestObject dynamically in the code (it won’t be persisted in Object Repository)
TestObject to = new TestObject()
to.addProperty('xpath', ConditionType.EQUALS, "//android.view.View](https://android.view.view/)[@resource-id=‘android:id/month_view’]/android.view.View[@content-desc='" + datePart + "'")
WebUI.click(to) // or any other keyword
where is the mistake ???
when i use
TestObject testObjectOne = new TestObject()
testObjectTwo.addProperty(“xpath”, ConditionType.EQUALS, “//android.view.View[@resource-id=‘android:id/month_view’]/android.view.View[@content-desc=‘03 may 2019’]”)
Mobile.tap(testObjectOne, 2)
Everything works correctly - the date is selected
when i try to use dynamic path
TestObject testObjectOne = new TestObject()
testObjectOne.addProperty(“xpath”, ConditionType.EQUALS, ‘//android.view.View[@resource-id=‘android:id/month_view’]/android.view.View["’ + datePart + ‘"]’)
Mobile.tap(testObjectOne, 2)
NO ERRORS but the date is NOT selected.
The xpath you’re using seems very long, so your test could break easily if there are small changes. I would recommend trying to give the views within your ListView a resource-id, if you can (this would require a change from a developer with access to your app’s code). This way, you could narrow down the xpath to a much shorter value, such as:
//android.view.View[@resource-id="my-list-of-items" and @content-desc="'" + " - " + cuenta + "'"]
If you can’t update the code, you could try making the xpath shorter anyway using just the last part of what you have:
//android.widget.ListView//android.view.View[@content-desc="'" + " - " + cuenta + "'"]
Finally, if what you’re trying to do is scroll through a list of elements, you can try an open source library that I created to help with common functions: https://github.com/detroit-labs/katalon-mobile-util
hola @Chris_Trevarthen lo hice de la manera en que me dices y no me funciona //android.widget.ListView//android.view.View[@content-desc="’" + " - " + cuenta + “’”], lo hago asi y no me funciona, podrias darme una ayuda para intentara solucionar eso, tengo varias semanas intentando y no he podido, cualquier cosa este es mi correo branyernuez@gmail.com
Do you get an error in the Katalon logs? Could you post it here?
Can you also try the steps in this post to see what is on the screen at the time of the test (do this part right before you start your try statement from above):