Need to have selector dynamically select the row based on a for each loop

Need help getting the selector to dynamically click on the right row as its running a for each loop for the scraped data. Below I scrape the data and assign it to in_CurrentRow

I’m passing that into an invoke workflow as an argument.

the bot needs to know what row to select and click that row in the application based on the correct row data
Here is the selector

I thought that if I

created a variable it would work but it does not, not sure what step I am missing


From the statment what i understood is, you have an excel with all the id’s. You need to Read the excel and loop through the Id. For each Id you need to identify the same in a web application and need to click on it. Hope my understanding is correct.

if above the requirement , plz follow the below steps:

  1. Read Excel and get the output to a DataTable Variable
    2)Open the applciation you want to action(web page)
  2. Use For Each Row in DataTable activity and loop through each row. To get each values you can use (CurrentRow(0).ToString, this will give the A column values)
    4)Inside Application scope, you need to give a click activity to click on the webpage( for clicking the desired values which you are getting from excel)

Note: Inorder to make the click activity dynamic, you need to check the selector. There should be some value in the selector( maybe aname=“30759970”), This value you need to repalce with the variable CurrentRow(0).ToString

Hi @jeff.shubzda ,

Use another String variable, say str_CurrentRow. Do the following operation using Assign Activity.

str_CurrrentRow = in_CurrentRow.ToString

Use the variable str_CurrentRow in the Selector.

You could also test the Validation by Providing a Default value to the variable.

Let us know if it doesn’t work. Also we might need to fine tune the Selector, Remove the unwanted attributes like css selector. Try Checking the Validation by keeping minimum attributes.

Correct as you see here these do not match
so the bot needs to click on the row in the application and needs to select the right row since there are three rows in this instance its row 3 but could be row 2 or 1

Can you confirm whether the selector is having some field like aname or title which matches the ID(30194108- Of the button you selected in the click activity). If it is there you can make it dynamic. Also you can use UIExplorer to get the reliable selector.

So I pass the argument into this workflow as int_CurrentRow then I created the new assign for str_CurrentRow = int_CurrentRow.tostring then I used the str_CurrnetRow in the selector but I could not get it to validate in the uiExplorer

@jeff.shubzda , We see a change in the Selector attribute from tableRow to tableCol.

The str_CurrentRow does indicate the row count and not the Column Count i presume.

Maybe Changing it to tableRow and assigning a Default value to the variable and Check the Validation in Edit Selector of the Activity, Not in UI Explorer.

in general we can use the index output from for each directly instead of doing redundandly with an index counter

When using dynamic selectors we would provide a default value and will use it for stand alone validations. The default value we do set to the value which we want to check / protoype

Without a default value a standalone validation with a dynamic selector involved will fail

Thank you both for the help I finally got it running now. thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.