Mobile Testing: Different button is tapped

Hello everyone! I am having a problem tapping the button that I want to tap. I have 2 buttons, “Exit” and “Yes, I’m over 21”. I used Mobile Object Spy, and I got the locator for the button “Yes, I’m over 21” and also consistently found it every time I use the highlight.

The TC:

But when I started running the project, It’s tapping the wrong button, the “Exit” button. I also tried to use getText, just to check if I got the correct object.

Actual running of the project, nevermind the while loop. :smile:

Thank you!


Please try this instead of Mobile.tap() on that element

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import io.appium.java_client.MobileElement

MobileElement element = MobileElementCommonHelper.findElement(findTestObject('element id'), 10)
1 Like

It worked! Thank you!