Mobile - Tap on object with Text "contain" X

I’m trying to think about how to approach this,
Use Case: When logging into a mobile once a button text comes back as “Continue as X”.
But when you rerun the test you get a new button that says “Continue”.

I don’t want to do an if statement but I was wondering if I can Tap on button object with text that contains “Continue”

You can with XPath like //*[contains(text(), 'Continue')]

1 Like

I don’t know what OS are you running, but for iOS there is something called accessibilityIdentifier that you can set to a string value of your choice, for example when you have tableViews or Lists you can set this progamatically to a unique identifier, then when you run your app you’ll see this identifier in the test recorder which will make your button more easily identifiable in the case you have multiple buttons on your screen, again this is what I know from experience on iOS testing, I wouldn’t know it there is an equivalent for other OS

1 Like