What is the workaround if object no Text and both textbox shared same resource id?

the mobile app that i going to test, at login page
both username and password using same
resource id
com.test.OneApp.sample:id/ControlEditTextWithLayoutEditText

there is no Text to identify them too.

i am able to input text at first box, but unable to do at next box. what is the workaround?

Mobile.setText(findTestObject(‘Object Repository/test/android.widget.TextView - SIGNIN - Email’),‘user1@test.com’, 10)

The web page is BROKEN. It is not legal to have more than one element with the same ID.

You should fail the test and explain to the developers why it has failed.

It’s native app. So what’s the best practise?

Sorry, I don’t know. When you said “page” I assumed it was a page :confused:

If the id is the same, then there must be another attribute that differentiates the two.

there is no other unique attribute i can see.
what you guys can do?
or any method that i can tap first then tap to second box by using katalon syntax?
or i can find the label text above the box and then tap into it?
the first box has text ‘username’ above it.

What about making an array of the id? The first id would be id[1] and the second id would be id[2].

1 Like

There are some Katalon commands that might be useful but I have never used these so don’t quote me. I am seeing:

  • Get Element Height
  • Get Element Left Position
  • Get Element Top Position

The last one might be good if the username and password fields are above and below one another. I believe you can store the top position into a variable e.g. usernamePosition and then tap at that position maybe? Hope it helps