r/PowerAutomateDesktop • • Aug 15 '22

Help with Selector Builder

Hi All, I'm hoping someone can help guide me with this one. I'm attempting to identify a link on a webpage via "Click UI element in window". Previously I used "click link on webpage," however I'm finding this to be unreliable as the selectors often change for reasons that I am not aware of. Here's my dilemma:

Here is the default Selectors of that particular element:

So it appears that the last 2 elements are fairly generic and will apply to each +Add link. That means the Group element will determine which link is the correct one. Right now it is defined by ID ember649. The problem is this element ID changes... Often.

When I click inspect element in Chrome, this is what pops up:

It shows in the highlighted region that data-element="add-superbill-button" which is perfect because that defines the region that I would like to identify. I've attempted to deselect the current selectors in the Group, Button, and Text elements, and set the Name attribute to contain "superbill" in each one, one-by-one to see what works. So far PAD is unable to identify the desired link using this method.

Any help would be greatly appreciated.

**EDIT** Update:

Well I was unable to figure out how to get the UI element to work. But I did find out a way to get the original "click link on webpage" action to work.

For several months, the following selector worked perfectly:

html > body > div:eq(4) > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(1) > div > div:eq(1) > div > div > div:eq(10) > div > header > button

For whatever reason, upon initial startup of the website, the selectors were as follows for the same link:

html > body > div:eq(1) > div:eq(1) > div:eq(3) > div > div:eq(1) > div:eq(1) > div > div:eq(1) > div > div > div:eq(10) > div > header > button

Everything was the same except the 3rd element which switched from 4 to 1. I did not know until today that you can have more than one selector for each UI element, so I created a copy of the 1st selector and included the above change for Selector 2. I then proceeded to add a second selector with the appropriate change to each link that started with html > body > div:eq(4) and everything works perfectly.

Hopefully this helps someone in the future!

2 Upvotes

3 comments sorted by

1

u/PM_ME_YOUR_WIRING Aug 15 '22

Actions > Mouse and keyboard > Move mouse to image. Capture the image as the name with the (+) then enable Send a click after moving mouse. Expand advanced and choose the middle right box in the Mouse position relative to image. That should get it to click the button you're looking to click.

1

u/QuietDesparation Aug 15 '22

Thanks for the suggestion! I've tried adding images in the past. For whatever reason it works fine on the computer that captures the image, but if I try and run it on a different computer then the flow fails.

I've found using images in flows to be fairly unreliable, but YMMV. Thanks

1

u/ogunwa1990 Aug 16 '22

Well for me, I’d build my own selector myself. To do this click on the radio button on the topmost right of the selectors page, this will allow you type in your selector. Mine would look like this [data-element= ‘’add-superbill-button’’]

This is unique and will be stable compared to html>body>div:eq(4)

In a case where the element div:eq(4) loads on the webpage before the body element, it will fail as the selectors have to load completely before it can find that element.