How do I get the robot to click on all buttons on a webpage with the same name?

Hi

I’m working on a script that will scrape health plan data from carrier websites. I need to simulate the actions that a human would take by inputting a zipcode, selecting a plan type, then navigating the menus to show all available plans in a given zipcode.

Once I get to this page with all available plans, there will always be x number of plans. So I need the robot to determine how many instances of the button labeled “Plan details” (or some other phrase) exists on the page, and then iteratively click on each button, so that it can scrape from each plan, then return back to the page with all available plans to continue scraping the remaining plans.

I’ve been googling and trying to make sense of some of the forum posts, but I’m not sure how to use the Find Children activity in order to find all instances of the same type of button to iterate through. Can someone please help? I’ll attach what I have created thus far. When I reach the find children activity, nothing is added to my IEnumerable object to loop through in the debugger, so I’m getting something wrong with the selectors.

Main.xaml (19.5 KB)

Thank you!

Hi,

We need to indicate selector which has all the target elements for FindChldren as the following.

And it’s better to use FIND_DESCENDATNS in scope property and Filter condition should be a minimum requirement.

Can you try the following?

Main(2).xaml (19.6 KB)

Regards,

This only works for the first click, on the next iteration, it runs into this error: “Click: Cannot send input to UI element because it is outside of screen bounds.”

Does this mean that the robot needs to see each of the buttons on the screen in order to click it?

Also could you explain the difference between descendants and children in this case?

Thank you!

Hi,

In this case, as there is no page in which FindChildren got elements, the element is no longer valid.
So we need to re-take element as the following, for example.

And I just modified it as the following. Can you try this?

Main(2)(1).xaml (22.4 KB)

Also could you explain the difference between descendants and children in this case?

Children mode gets elements immediately below the target element.
Descendants mode gets all the elements below the target element.

Regards,

That works! I don’t fully understand it, so correct me if I’m wrong.

Are you creating index values based on how many indices are in the initial ienumerable object?

When you retake the element, you’re then creating another ienumerable object to loop through, and setting the index to the current loop of the first ienumerable?

Then by setting the focus on the exact button at given iteration, the robot knows which button to click on?

Thank you so much for you help!

Hi,

Roughly correct. The first FindChildren is for just to get number of elements. And it’s used how many times to loop.

Regards,

Do you think you can help me understand why I can’t get selectors to work during runtime in this process? I validate the selectors with Ui Explorer in Studio, but when I test, no combination of validated selectors works. I get invalid selector errors.
Main.xaml (23.8 KB)

Hi,

Can you elaborate? I cannot get which element you want to click.

Regards,

Here’s a screen with the filter and selector I’m currently using. The first find children activity fails even though I validate the selectors before running. I don’t understand why. I have not been able to find a combination of valid selectors that work during run time when I debug the process.

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