Hello,
I have a table where each time I have to enter a new row and enter some value on the newly added row. The structure look like this
The challenge is each time, the newly added row will have dynamic IDs such as disputeCauseSubviewId:disputeCauseFormId:disputeCauseDataTableId:1:disputeCauseInputField
disputeCauseSubviewId:disputeCauseFormId:disputeCauseDataTableId:2:disputeCauseInputField etc.
How can I write a script where I can find out the empty row and enter some value. Please suggest.
Regards,
Neethu
Hi @neethu73
Hi, you can try to use CSS Locator. I noticed that the inputs although have different Ids but the same class. Here are the steps you may try:
- First retrieve all web elements with the class dm_disputeCause-dataTable_textField.
- Iterate over these elements, in each iteration you check:
â If the element doesnât contain text, then set your text in here and terminate the loop.
â Else keep iterating.
Please try it yourself and let us know where you get stuck.
Regards !
Hello @ThanhTo,
Thanks for the quick response.
I managed to find another solution (i am not sure whether its the right way, but it worked
) . I captured the blank row and added a new property as value and kept that as empty as showed below.
and I unchecked all other propertie. Somehow it worked and now I am able to enter value for the blank field. My scripts is as follows.
WebUI.click(findTestObject(âDispute Management - Dispute Cause/Page_eSDMS - root/input_Cause Of Dispute_disputeCauseSubviewIdâ)) â for adding a new row
WebUI.delay(3)
WebUI.setText(findTestObject(âDispute Management - Dispute Cause/Page_eSDMS - root/Page_eSDMS - root/input_Cause Of Dispute_disputeCauseSubviewIddisputeCauseFormIddisputeCauseDataâ),
âtesting 2â) â for setting the text in the newly added row
WebUI.delay(3)
WebUI.click(findTestObject(âDispute Management - Dispute Cause/Page_eSDMS - root/input__disputeCauseSubviewIddisputeCauseFormIdsaveButtonâ)) â for saving the newly added row
Is it a proper solution, I am wondering.
1 Like
Hi @neethu73
Itâs a valid solution. I think it works because a newly added row always has an empty value property, so by identifying the object with nothing but the blank value property you can always find an empty row.
Regards !
hi @ThanhTo,
Could you please show how to find all the input fields and then iterate them to know if them are fulfilled or not?
It is posible by writing katalon groovy script or should I unwrap to code into selenium way and do findelements() like selenium webDriver Does with java?
Thanks
Hi @francoarebuffi
I think the ideal way would be to use findElements() of Selenium. Then you can iterate over the returned web elements and convert them into Katalonâs test objects and then you can use the functionalities provided in WebUI to get/set text.
Regards !