I have a column in excel with different numbers and I want to click in browser the checkbox which is next to the same number of excel.
For example, the first row is number 2, then I want to click the checbox which is next to number 2 (see screenshot attached).
Moreover, if the number I want to click doesn’t appear in the screen, I want to click in “Av.Página”.
I have the numbers from excel stored in a variable and I tried to use find element activity and then click activity using dynamic selectors. However, dynamic selectors doesn’t work.
The process I followed is: in find element activity select number 2 from brwoser and then add “aaname” attribute in UISelectors and change number 2 for the name of the variable.
Do you know which could be the error with dynamic selectors or another option to run this process?
The selector for the checkbox looks like this. As in the checkbox doesn’t appear any number, I can’t change the number for the variable.
So, what I was trying to do is use anchor base activity where the anchor is the cell next to the checkbox and the activity is click the checkbox. That’s why the selector I attached before is for the cell next to the checkbox. Do you think that’s correct?
Yes, you are on the correct path using anchor base activity if there’s no way to identify the checkbox alone.
Is the id for the checkbox random or is connected to the number some how? Maybe “check_13_2” refers to the row with number 2? What is the id for the other checkboxes?
If it’s connected, maybe something like this would work:
It’s connected but what changes is the number 13 which doesn’t have any relation with the variable.
The selector attached is the id for checkbox number 5.
Ok, if anchor base doesn’t work for you, test with this: Use Get Attribute activity to get the “tableRow” attribute from the cell next to the checkbox. Save it to let’s say, strTableRow.
The selector should look like in the screenshot you posted but the remove the space in aaname. It should be aaname='{{TarifaNumString}}' without any space.
In the Click activity, set the following selector:
It’s OK to write the TarifaNumString variable as attribute? I didn’t know which attribute to put, but like I show you in the screenshot, it doesn’t work.
No, in the text field you should enter “tableRow”, because that is the attribute you want to access. Create a new variable called strTableRow to save the result.
The TarifaNumString should contain the value you get from Excel.
It appers error as well… I attached a screenshot from the error, so you can see how it looks.
I also tried to do this process without variables, meaning enter manually each number, and the robot doesn’t find the elements either. For example if I want to find number 2 in browser, the robot doesn’t find number 2 when actually there is number 2 in the screen. Maybe the problem is the browser?
From your screenshot, it seems like the aaname contains two spaces before 2 and a space after. The best is to select the cell with Ui Explorer and then replace only the 2 with {{TarifiaNumString}} and let all the surrounding spaces be. (Sorry for telling you to remove the space before. I didn’t know that **aaname ** had leading/trailing spaces.)
FlexGrid is also changing number. Test with this selector instead. It uses Regex to ignore any leading/trailing spaces and a wild card to ignore the FlexGrid number.
The Get Attribute is working fine now. Just update the selector for the Click activity. You can copy and paste it. There’s no need for id since we are using tableCol och tableRow to identify the checkbox.