Katalon cannot interact with iOS objects via xpath


I am testing an app on iOS and Android and sometimes I need to interact with objects via xpath.
On Android it works fine, on iOS it never works.
Did somebody faced the same issue?

Thank you.

Hey Monica @monica.canziani, can you provide screenshots and list the steps you are trying to configure with the iOS? Follow this post to see how you can structure your inquiry for us to understand your problem better.

1 Like

Hi @chen.lee ,

for example, I detected this object and the xpath is something like this:


But I cannot interact with it.

MicrosoftTeams-image (14)

@monica.canziani, can you show the error log so we can see what the problem is?


for example I tried to tap on this element:


And obtained this error:

07-21-2022 12:18:42 PM tap(findTestObject(“Cases/Case_Documents/XCUIElementTypeStaticText - FilmatoWMV_automation”), 0)

Elapsed time: 30,393s

Failed to tap on element ‘Object Repository/Cases/Case_Documents/XCUIElementTypeStaticText - FilmatoWMV_automation’ (Root cause: com.kms.katalon.core.exception.StepFailedException: Object Object Repository/Cases/Case_Documents/XCUIElementTypeStaticText - FilmatoWMV_automation not found
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.stepFailed(MobileKeywordMain.groovy:40)
at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.doCall(TapKeyword.groovy:79)
at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword$_tap_closure1.call(TapKeyword.groovy)
at com.kms.katalon.core.mobile.keyword.internal.MobileKeywordMain.runKeyword(MobileKeywordMain.groovy:21)
at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.tap(TapKeyword.groovy:84)
at com.kms.katalon.core.mobile.keyword.builtin.TapKeyword.execute(TapKeyword.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.tap(MobileBuiltInKeywords.groovy:1490)
at com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords$tap$1.call(Unknown Source)
at Cases_DocumentPreview.run(Cases_DocumentPreview:46)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:445)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:436)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:415)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:407)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:284)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1658398622086.run(TempTestCase1658398622086.groovy:25)

@monica.canziani, did you use KS mobile spy to get your XPath, or is it a custom XPath that you create? If it’s a custom XPath, can you try using KS mobile spy for Katalon to capture the exact XPath?

@chen.lee this was the exact xpath extracted by Katalon Studio.
I didn’t even know that a custom xpath was possible to set.

@monica.canziani, in the Object Properties, can you uncheck xpath and check type, label, and name under Detect object by? to see whether KS could detect the object?

Yes, I can. But in certain contexts I need to use the xpath.
I could manipulate the xpath inside, but I have no clue about how to write a correct xpath for my context, so I rely on the default provided by Katalon.

In that case, you would need to provide the device model and the list of processes for us to reconstruct the process on our side to figure out your problem.

@chen.lee this happens with every model of iPhone I have set. I’m using a physical local device (which is an iPhone 13) and both remote physical devices (via Browserstack).

@monica.canziani, can you provide the application and the exact steps you attempt so we can reproduce the precise process on our side?

@chen.lee I am sorry, I can’t share the app I am testing.

But I made a quick test on another app (eg. Apple Podcasts) trying to interact with an object via XPATH.
I wanted to tap on “See All” but I faced the same error: object via xpath on iOS are detected but you cannot interact with them.

Katalon Studio version: 8.4.0

@monica.canziani, we managed to reproduce your problem on the device, and we could not detect the object with just the XPath. We will raise this problem with the Product Team and see what they have to say about it.

1 Like

Thanks a lot :slight_smile:

@monica.canziani, I got an update from the Product Team, in which they suggested you can make objects more dynamic and absolute.


- //*[@class = 'android.widget.TextView' and (@text = 'One-time password code' or . = 'One-time password code') and @resource-id = 'com.azure.authenticator:id/action_name']//following-sibling::android.widget.TextSwitcher

@chen.lee I know this, but as I said in the first comment, in certain contexts I need to use the Xpath.
Since it is seletcable, I would like to use it, as I do in Android apps.

@monica.canziani, the above method is still using an Xpath, it is just a relative Xpath and not an absolute one. You can check this link about Xpath.

Alright, but why do I don’t have to change it while testing Android apps? I’m following the same steps.
The only difference is that sometimes I use xpath as an “Attribute” instead of XPATH (and this should not be a difference), but the xpath is the same. I’m using the xpath extracted by Katalon.