How to get Dynamic ID? Need some help!

Hi, I’m a new user for Katalon. I want to create an automatic test script for our system. However, our some buttons (actually all of them!) have dynamic ID add to the end of ID, Xpath and CSS. This makes me very hard to get the right address.
I found some button have the order number and I believe I can catch. But I met several problem, how to make sure I got the elements (like how to print the variable on the screen). Then the second issue is I don’t know how to merge two variables (for example, ‘Hello’ + ‘123’ = ‘Hello123’) . Also I believe my ‘123’ is still a string, so I need to change it to digital first and then minus a number. The last question is how to use the new variable to locate the address (I need to settext to that bar).

Sorry, I wrote the questions too fragmentary. These are the questions:
1. how to print the variable on the screen to check function working?
2. how to merge two variables in Katalon?
3. how to change variable type?
4. how to use this variable to locate the address and set text?
5. Is there any other way to solve this problem?
6. Do Katalon allow using selenium? How?

QQ截图20181108173036.jpg

1 Like

Hi Wang!

How it looks in html context?

1 Like

QQ截图20181112141944.jpg

def variable = “some text”
println variable //some text

def var1 = “Hello”
def var2= “123”
println var1+var2 /Hello123

3. Scripts are written in groovy, so there’s no need to define variables explicitly. To switch between variable types you can use groovy methods such as toString() or toInteger()…

1 Like