Xpath's using

Hello everyone. I have an element’s xpath on mobile testing under record mobile tab under object properties. How can I use it?

You can use the xpath to find an object in a few ways:

Using Mobile Recorder/Spy Mobile

You can use the Mobile Recorder/Spy Mobile to save/export a new Test Object in the Object Repository:

https://docs.katalon.com/display/KD/Spy+Mobile+Utility

You can then double-click that Test Object to edit the properties. Edit the Attributes to uncheck everything except the xpath:

Creating New Test Object in Object Repository

Alternatively, you can create a new Test Object in the Object Repository, giving it the “xpath” Name, “equals” Condition, and pasting in the Value of the xpath you want:

https://docs.katalon.com/display/KD/Manage+Test+Object

Creating New Test Object in Code

Finally, if you’d like to find an object by xpath in code, you can do the following:

import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObject
TestObject myNewObject = new TestObject("TheObjectName")
myNewObject.addProperty("xpath", ConditionType.EQUALS, "//html/body")
1 Like

@Chris Trevarthen Thank you so much !!!