On my webpage, I have a list of Departments. Each department has a checkbox, as you can see below:
I have an Excel file which has a subset list of Departments:
In RPA, I want to loop through each record (department) from Excel. Then, for each department, I want to search for the department on my webpage, and then click the checkbox to the right of it.
1. Start loop
2. Start first iteration
3. Search 46th & R Motor Vehicles on the webpage, then click the checkbox to the right of it
4. ...Do other actions and end first iteration...
5. Start second iteration
6. Search 605 Building, then click the checkbox to the right of it
7. ...Do other actions and end second iteration...
8. Start third iteration
9. Administrative Services, then click the checkbox to the right of it
10. ...Do other actions and end third iteration...
11. End loop
Best answer by bradwyattView original
You can utilize the HTML property called HTML innerText or HTML Value to get the text from page through the Capture action. Once you have it, compare the same with the excel record using the IF condition. If they are matching, you can click the check box.
Thanks for the suggestion.
I was able to use HTML innerText to extract all the text from the page’s div. Screenshot below for reference.
If I did a Recorder Capture and clicked the first checkbox, it would just check the first checkbox on the page each time I loop through the Excel records, but I want to be able to check the checkbox only for the matching Departments. So how can I check the checkbox only on the matching Departments?
For reference, each element on the page has the following HTML:
I figured out how to solve what I was trying to do.
What I did, was I created a loop up to a specified number. For each iteration, I named the output variable $Counter$, and then I converted number to string and called it $CounterToString$.
Then, I did “Record: Capture” and I selected a checkbox on the page (it could be any of them). Then, under “Path”, I replaced what would have been the position of the checkbox on that page, with $CounterToString$.
This also corresponded to the following DOMXPath: