Use variable in xpath

@ThanhTo

Please improve the explanation in the Katalon Documentation in

Many people ask the same question repeatedly.

They understand that

(1) they need to write a xpath with placeholder: //tr[${i}]/td[${j}]/div

(2) they need to set values to the variables i and j.

But they do not understand that

(3) they need to call findTestObject method with 2nd argument: a list of [placeholderName: value] pairs.

println WebUI.getText(findTestObject(myTestObjectId, ['i' : 3, 'j': 3]))

The official documentation is too long, so they would not read it. The doc explains the point (1), but it is not explicit enough about (3). It has too few examples.

1 Like

I could find a section on Parameterizing Mobile Test Object.

I could find a section on Parameterizing Web Service Object.

But now I could find no section on Parameterizing Web UI Test Object. Have you removed it?

@eug

It seems you have the following fragment in your test object

//tr[${i}/td[${j}]

This is wrong. One ] character is missing. It should be:

//tr[${i}]/td[${j}]
1 Like

Hi @kazurayam

I will update the Parameterize Mobile Test Object document accordingly. I appreciate your feedback.

The Parameterize web test object document is combined with the Web test object document. Considered it’s difficult for users to search for it, I will change it. Thank you.

Jass

Thanks . I was able to execute my test script. :slight_smile: