I have 11 dynamic web element to capture as below.
//[@id=“content”]/app-view/div/div[1]/div[1]/app-data-folder/div/div[1]/div/div[9]/img
//[@id=“content”]/app-view/div/div[1]/div[1]/app-data-folder/div/div[1]/div/div[10]/img
When find the xpath i want to click on it. How to handle this kind of dynamic xpaths in katalon?
Create a Test Object of “Attribute” type. Specify xpath selector for it as follows
//*[@id="content"]/app-view/div/div[1]/div[1]/app-data-folder/div/div[1]/div/div[${index}]/img
Please find a placeholder ${index} in the xpath.
In you test case script, you use the test object with value to the index parameter: For example
for (int i in 9..10) {
WebUI.verifyElementPresent(findTestObject('your test object name', ['index': i]), 10)
}
then the placeholder ${index} in the xpath expression will be replaced with the values : 9 or 10 runtime.
See Katalon document Parameterize Web/Moble Test Object property for official description.
1 Like
@kazurayam… Thanks for the quick solution …I’ll try with your solution…
