Hi,
How to find mobile elements by xpath and which import statements are required for this?
I found with mobile recorder. Click on mobile recorder and after click which elements you need and you will see xpath under object properties.
Aalok said:
Hi,
How to find mobile elements by xpath and which import statements are required for this?
I found with mobile recorder. Click on mobile recorder and after click which elements you need and you will see xpath under object properties.
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")
Thanks …It worked for me.