Need to enter dynamic text every time the script runs
Is it possible to solve this by creating a variable that links to your csv or other source of dynamic text? Then call that variable for use in your test case scripts.
Test for the attribute value, this way its searching for a dynamic value versus static text. `attribute = WebUI.getAttribute(findTestObject(....), 'value')
`http://forum.katalon.com/discussion/4423/capture-dynamically-generated-text-from-the-text-box
Also hereâs a link to an article posted on Medium that could help you use XPath to check for dynamic text. https://medium.com/@katalon_studio/generating-reliable-object-selector-using-spy-web-utility-katalon-studio-c44e18b8d39c
ok, so i put âgenerate random text in groovyâ to google and here is some solution:
hope this is what you are looking for because header of this post does not correspond with question you asked.
Hey Andrej,
how to put this definition into the Katalon script mode ?
Binary statement or method call statement ?
How often are you going to use the randomString method? If more than once, put it in a Keyword.
This is not working for me too. Please help
I need to enter a dynamic text in the search field, every time I run the test script.
I have used both get text and get attribute, I am getting the value successfully. However, when the set the same text in the search, my script fails.
value = WebUI.getAttribute(findTestObject(âObject 1â), âtextâ)
WebUI.click(findTestObject('Object 2))
WebUI.setText(findTestObject(âObject 2â), value)
It doesnât start typing the field and fails. Please help me how to fix it. Thanks
@ishrat.manzoor Can I suggest that you print out the value contents to see if you actually have got the text.
value = WebUI.getAttribute(findTestObject('Object 1'), 'text')
WebUI.comment('the value is:' + value)
WebUI.click(findTestObject('Object 2'))
Another way
Can you also try the following?
celltext = WebUI.getAttribute(findTestObject('Object 1'), 'value')
WebUI.comment('the value is:' + celltext)
WebUI.click(findTestObject('Object 2'))
WebUI.setText(findTestObject('Object 2'), celltext)
@grylion54 Here is the text that I am getting:
I tried the another way too but the Value is coming as null. And I simply want the text(label) of the element on which I am clicking and search with that text.
Hey it worked, my bad I wasnât actually giving the proper Test object. So the value was coming up with the question marks which wasnât working in Set text.
Fixed it nowâŠThank you so much
