web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Replacing OCR with Dyn...
Power Automate
Answered

Replacing OCR with Dynamic UI Element

(1) ShareShare
ReportReport
Posted on by 24
I have a complex Flow that in one part uses OCR to click on a name in a table. It works as expected but is a bit slow. I have tried to replace the action with a dynamic Click on UI Element but have failed to get the action to work.
 
I have tried many versions of a UI element with and without the text editor selected but have failed to get it to work.
 
div[Id="main_content"] > div > div > div > div > table > tbody > tr > td > a[Text~="%Player['Handle']%"]
is typical of the selectors I've tried. 
 
I'd appreciate any suggestions to replace the OCR with a smarter solution.
 
 
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,522 Super User 2026 Season 1 on at
    What is the ~= operator in the anchor elements Text attribute that check %Player['Handle']%?
    div[Id="main_content"] > div > div > div > div > table > tbody > tr > td > a[Text~="%Player['Handle']%"]

    I haven't ever used that myself. Is it a typo and should it be just equals or is it something that should work in that selector?

    Try the selector first without the variable value so with hard coded value that you know exists in the web page. Example:
    div[Id="main_content"] > div > div > div > div > table > tbody > tr > td > a[Text~="1234"]

    Then if that works check that the variable value is exactly that. It could be that the Player['Handle'] has some extra spaces or characters that makes it not find the element.

    Try to test the selector when the element is visible on your screen and see which element goes to error in that selector. Like so:
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,150 Super User 2026 Season 1 on at
    Hi,
     
    Issue:div[Id="main_content"] > div > div > div > div > table > tbody > tr > td > a[Text~="%Player['Handle']%"]
    • %Player['Handle']% does not get expanded inside selectors like this.

    • The selector syntax requires real selector parameterization, not string interpolation.

    Change Selector

    • This gives you a base selector.

    • Edit the selector and look for:

      webctrl tag='A' innertext='[the text you clicked]' />

      or something similar.

    Example raw selector:

    <webctrl parentid='main_content' tag='A' innertext='John Doe' />
     
     

    Instead, you click “…” > Edit Parameters in the selector editor.

    Steps:

     Click “…” on your UI element > Edit Selector

     Locate innertext='John Doe'

     Click the small fx icon next to innertext, and select your variable:

    Player['Handle']

     It should now look like:

    <webctrl tag='A' innertext='{Player['Handle']}' />
     
    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz
  • Verified answer
    Trevor_T Profile Picture
    24 on at
    Hi Riyaz,
    Thanks for that response.
    My flow does not have Power Fx enabled so your solution doesn't quite work for me.
    BUT you gave me the solution to my problem!
    I set a new variable within my loop as %Player['Handle']% and used this variable in the selector thus not requiring the expansion within the selector.
     
  • Trevor_T Profile Picture
    24 on at
    HI eetuRobo,
     
    I tried using Copilot to solve my problem and the ~ within the selector "contains" the variable not just =
    In the past, I've always used an * for that expression, just didn't notice the change when copying Copilot's suggestion.
     
    Thanks for your suggestions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard