cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
a1b4tross
Advocate I
Advocate I

Failed to get UI Element

Hi, I am trying to automate a small task in AX 2012 using Power Automate but I am getting an error:

For automation I am using Power Automate Desktop Recorder, everything is working fine except  when I am clicking filter part, or textbox

Below is the error I am getting for textbox:

a1b4tross_0-1607725369606.png

 

 

Now, when I am trying to automate below part:

a1b4tross_1-1607725369614.png

 

 

Checkbox is also giving error as::

a1b4tross_2-1607725369616.png

 

 

Any help how to resolve this would be really appreciated.

Thanks in advance.

All I am trying to do is:

a1b4tross_3-1607725369622.png

 

  • Checkbox record selection should automate
  • Records in above shown image should come as per Text typed in textbox  and should be filtered according to Customer Account
8 REPLIES 8
John_Mavridis
Microsoft
Microsoft

Hello there,

Based on the nature of the errors, you may have run into a scenario where the selectors of the elements you captured are somewhat dynamic, meaning that they may be different during development (when you extract the controls) and during execution, which would lead to errors like the ones you got.

 

In order to identify the cause of the issue here, you would need to compare the selectors of the UI elements that you have already captured, with the ones that seem to be in place in the application during execution. To do that, I would recommend running the flow, and after making sure that the error is thrown (meaning that there is indeed a difference between the captured and current selectors), you could recapture the same elements, just for the purposes of cross-checking the selector values against each other.

 

You would be able to do that, navigating to the UI elements pane, then double-clicking on the respective elements:

John_Mavridis_0-1608208186455.png

 

Please let us know if the above approach helps you identify any differences. Thanks!

 

 

 

What can I do if the selectors of the elements I captured are dynamic? Is there a way to use wildcards like in UiPath? I tried to edit the selector but Power Automate Desktop will not let me.

HEATFreight
Advocate III
Advocate III

Yeah I thought there was a * wildcard but I can't get it to work. How would I make the following example work? Below are two different instances of the same drop-down menu selector as they appear by default -before modification:

 

iframe[Id="window_iframe_0"]  iframe[Id="frameID_640222794"]  select[Id="load_status"]

 

vs.

 

iframe[Id="window_iframe_0"]  iframe[Id="frameID_1555015484"]  select[Id="load_status"]

 

 

I've tried replacing the frameID number with an asterisk. I've tried deleting it but keeping the rest of the syntax. I've tried truncating from the underscore all the way through the bracket. I've tried various combinations of cutting out all or part of one or both of the iframe segments. I've tried pasting in the element from the inspector. Here's is how the drop-down menu appears when you copy it from the inspected webpage:

 

<select name="status" id="load_status" onchange="parent.parent.setWindowEdited(); StatusUpdate (this.options[this.selectedIndex].value);" style="width: 100px;">
                    <option value="open">Open</option><option value="covered" selected="selected">Covered</option><option value="dispatched">Dispatched</option><option value="loading">Loading</option><option value="on_route">On Route</option><option value="unloading">Unloading</option><option value="on_yard">In Yard</option>				</select>

 

 

The default selector for this drop-down works exactly once, well until you close the iframe(?) that this element resides in or the webpage itself. I am able to get the dropdown focused and selected using a >UI Automation >Form Filling >Set Drop-down action, but that one has never successfully made a selection, whether by index or value. It does cause the UI element of the drop-down menu to open up, but no selection is made. I am more successful with a >Web Automation >Web Form Filling >Set Drop-Down action. This is the one that turns the field yellow while it's successfully editing the field. I can make this work only with the specific instance of the drop-down element that I used to "Add UI Element". After that -after I refresh or close the page, or even just close the iframe- the drop-down element gets a different frameID and the selector breaks. I have had success with other drop-downs on this same webpage, some of which required editing the selector. This one is particularly troublesome.

 

HEATFreight
Advocate III
Advocate III

Oh I fixed it by changing the frameID selector from to "starts with" instead of "equals" and I truncated the number, leaving only "frameID_". That worked 👍

John_Mavridis
Microsoft
Microsoft

Hi there,

 

That's exactly right, you can edit your selectors and choose between the available operators to make them dynamic enough for each case you run into.

John_Mavridis_0-1615455113860.png

 

Can you add in variables and other logic to the selectors or are you stuck with static strings?

I get how static strings can be more dynamic if they can match to any iteration of the web page and not just a single instance, but I see the potential for certain web content to need parametric selectors, meaning they would change based on value of variables or equations. Parametric selectors would be far more dynamic than simply editing basic selectors to be less specific.

Is that possible?

John_Mavridis
Microsoft
Microsoft

Hello, 

 

This is indeed possible via the 'custom' selector option:

John_Mavridis_0-1615480171625.png

 

John_Mavridis_1-1615480199591.png

 

In the second screen, you would be able to normally use variables and edit your selectors however you'd like, in order to make them as dynamic as possible.

 

Well I figured as much but the syntax isn't obvious and I haven't found much documentation with examples.

I think I tried this but I had no luck. Far more reliable in my use cases to simply truncate iframe ID numbers that get randomly generated, and set the selector to "starts with". I don't think I had the correct variable syntax in the custom selector editor.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,870)