Issue with two objects with the same XPATH and attributes


I am performing UI automation with IOS simulator on a mobile app. I came across an issue with the login text fields having identical object attributes as well as path and when setting text in the fields it sets the text in the same field to no surprise. Is there a fix/workaround for this? Please see below the object attributes. Thanks.

Note that I have tried using the other object attributes but the objects are not found when I run the script. With this issue, we cannot automate the mobile app login.

Katalon Studio: 8.0.5
IOS 14.5

usually you can add array index in case xpath returns more than 1 element:

Hi Andrej,

I’m not sure I follow your solution. In my case both XPATHs are exactly the same.

imagine following path:


this xpath will return 2 objects ( 2 input fields with same xpath)
to distinguish between them, use array notation to adress either 1st or 2nd of them:


for 1st resp.


for 2nd element

hi Andrej,

By the way, this is with Mobile, not Web.
This is what the XPATHS look like for the 2 objects:


So how can I select a specific object with this XPATH? Do I need to make changes to the XPATH in the object repository as shown below?

object 1:


object 2:


And then how do I setText for these objects using scripting?


cant you use those paths? that is wat i was refering to

When I changed the objects in the object repository to this:

object 1:


object 2:


And use this command line to set the text in the respective fields:

Mobile.setText(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypeTextField - Locator Service URL’), locatorService, 30)

Mobile.setEncryptedText(findTestObject(‘Object Repository/Login Screen/IOS/XCUIElementTypeTextField - Email’), username, 30)

Result: The locatorService text and username text is set in the same field.

Is the problem in the scripting? Or there is something I need to change in the Object Repository for those objects? Thanks.

Ok I got it to work it seems. I will run more tests to confirm. Thanks for your help!

1 Like