Set up fallback UI automation mechanism in Power Automate Desktop flow
Use Case
Microsoft has introduced a feature to provide a reliable solution for UI and browser automation actions. With this feature, users can set up a fallback mechanism for UI automation actions in case the UI element cannot be found through the set selector(s).
I will demonstrate the image fallback solution by taking an example of click link action. The class of link element on web page has been updated and cannot be found by PAD during execution. We will see how this feature improves the automation by reducing the risk of errors and delays caused by missing UI elements
Prerequisite
You need to have PAD 2.45 version installed on the machine.
Solution
Create a new PAD flow. Give it appropriate name. Next, add a new action “Launch New Microsoft Edge” to open a site:
Enter value in input parameters:
Initial URL: https://www.microsoft.com/en-us/
Window state: Maximized (choose from dropdown)
Now, add “Click link on page” action. Select from drop down %Browser% in the ‘Web browser instance’ parameter:
Click & expand ‘UI element’ drop down. Click ‘Add UI element’ button:
Select ‘Shop Now’ link button and once it is highlighted (as shown below) press ctrl + mouse left click to capture & save the selector in the action:
You will return to flow with UI selector for link button:
Click edit button (pencil icon) to edit the UI selector:
Here is the catch, click ‘Image as fallback’ button in the command bar to capture the fallback image of the UI selector:
Go to the web page to capture the image of the link button. Select the link button until it becomes highlighted (as shown below) and press ctrl + mouse left click:
You will be taken back to selector edit screen. You will notice that an image of the selector has been saved:
Save the action and the flow.
Test Result
Let’s test the image fallback method by manually updating the link button selector to make it invalid. Open the link button selector in edit mode & toggle on ‘Text editor’ switch on the top right corner of the screen:
Edit the div tag id and text attribute of anchor element to make it invalid:
div[Id="card-body-highlight-uidb24567890"] > div > a[Text="Shop now1234"]
Save the selector & run the PAD.
You will notice that flow does not stop & throw error due to invalid selector but click link button and move to next web page:
NOTE: If you delete the fallback image and rerun the flow, you will receive invalid selector error:
Conclusion
Using “Image as fallback” feature, user can improve their automation processes and reduce the risk of errors and delays caused by missing UI elements. This feature can save businesses time and money, and ultimately improve the overall efficiency of their operations.
Deepali Jagtap
It’s nice to see this feature available in PAD. and you explained it so nicely and made it easy to understand.
Manish Solanki
Thanks Deepali. I am glad you find it useful 🙂