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 / Click a link on web pa...
Power Automate
Answered

Click a link on web page not working

(0) ShareShare
ReportReport
Posted on by 12

Hi all

 

I have a workflow where I want to click a button on a web page and despite trying several options on the UI element I cannot get it to work. Keep receiving error messages like this one:

 

Element with selector 'a[Id="u4_twolinestab-1085"]' not found

 

I’ve resorted to other actions such as ‘Move mouse to text on screen (OCR) > Send mouse click’ but don’t think that’s the best solution and it becomes tricky where the on screen text is duplicated in several places.

 

Below is the code for a button called ‘Procurement’ which I want to click. Any suggestions?

 

Thanks in advance!

 

<a class="x-tab u4-twolines-tab x-unselectable x-tab-after-title x-box-item x-tab-u4-tab-panel x-noicon x-tab-noicon x-tab-u4-tab-panel-noicon x-left x-tab-left x-tab-u4-tab-panel-left u4-multilinebutton-mixin-button x-active x-tab-active x-tab-u4-tab-panel-active x-left-active x-tab-left-active x-tab-u4-tab-panel-left-active" style="margin: 0px; right: auto; left: -50px; top: 185px;" role="tab" data-hidefocus="" data-unselectable="" tabindex="0" id="u4_twolinestab-1150" data-u4id="u4_twolinestab_3" data-u4xtype="u4_twolinestab" aria-label="Procurement"><div id="u4_twolinestab-1150-multilineWrap" class="u4-multilinebutton-mixin-line-wrapper" style="padding-top: 18px;" data-qtip=""><div id="u4_twolinestab-1150-multilineLine-0" class="u4-multilinebutton-mixin-line" style=""></div><div id="u4_twolinestab-1150-multilineLine-1" class="u4-multilinebutton-mixin-last-line" style="">Procurement</div></div><span id="u4_twolinestab-1150-btnWrap" class="x-tab-wrap" data-unselectable="on" style="display: none;"><span id="u4_twolinestab-1150-btnEl" class="x-tab-button"><span id="u4_twolinestab-1150-btnInnerEl" class="x-tab-inner x-tab-inner-center" data-unselectable="on" aria-hidden="true">Procurement</span><span role="img" id="u4_twolinestab-1150-btnIconEl" class="x-tab-icon-el  " data-unselectable="on" style="" aria-hidden="true"></span></span></span></a>

 

<div id="u4_twolinestab-1150-multilineWrap" class="u4-multilinebutton-mixin-line-wrapper" style="padding-top: 18px;" data-qtip=""><div id="u4_twolinestab-1150-multilineLine-0" class="u4-multilinebutton-mixin-line" style=""></div><div id="u4_twolinestab-1150-multilineLine-1" class="u4-multilinebutton-mixin-last-line" style="">Procurement</div></div>

 

<span id="u4_twolinestab-1150-btnWrap" class="x-tab-wrap" data-unselectable="on" style="display: none;"><span id="u4_twolinestab-1150-btnEl" class="x-tab-button"><span id="u4_twolinestab-1150-btnInnerEl" class="x-tab-inner x-tab-inner-center" data-unselectable="on" aria-hidden="true">Procurement</span><span role="img" id="u4_twolinestab-1150-btnIconEl" class="x-tab-icon-el  " data-unselectable="on" style="" aria-hidden="true"></span></span></span>

I have the same question (0)
  • Lawro Profile Picture
    12 on at

    Looking back at the code it is apparent that the 4 digit number at the of the id changes each time. Perhaps this is a security feature as this is a finance system.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I would guess the Id of the element might be dynamic and change when you refresh the page or run a new instance. Try adjusting the selector to not use the Id of the element and instead use some more parent elements to base it on the location of the element in the hierarchy.

    Hard to be more specific with the details provided.

  • trice602 Profile Picture
    16,294 Super User 2026 Season 1 on at

    I have made the 1085 value a %variable% and then the code becomes dynamic.  This has worked well for me for the past year on a high-volume RPA - assuming you know where/what 1085 and 1150 mean.  I have a better solution that is even stronger:  in many cases clicking on a button is not always bulletproof but what I have found works really well as an alternative is to Send keys (if you can get the cursor close above the button and then {Tab} as many times as you need to get to the button and then {Space} - that simulates the button press.  I have a similar challenge where nothing really worked, dynamic code, images, etc but sending keys has been great in production.  Let me know if sending keys works for you.  Tom

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    I would absolutely advise not to use mouse clicks and keystrokes as a 'better' alternative to clicking actual buttons via selectors. That is never a better practice, as it is much more unstable and relies much more on the overall layout of the page.

     

    @Lawro if the Id is dynamic, you could modify the selector to not use the full Id, but use an operator that says 'Starts with' or 'Contains' and remove the part that changes with every instance. This could make it work. But it might also make your Id not unique and make the flow press a completely different button, in which case you might want to add more pieces to the selector. 

     

    See this article for how to modify selectors and get an idea of what I mean: https://learn.microsoft.com/en-us/power-automate/desktop-flows/build-custom-selectors 

  • Verified answer
    Gidi Profile Picture
    601 on at

    As already suggested you shoul try to customize the selector, e.g.

    a[Id^="u4_twolinestab-"][aria-label="Procurement"]

  • Lawro Profile Picture
    12 on at

    Thanks for the replies all. I've a lot to learn about CSS and modifying selectors. Feels a bit like the learning curve on what should be a very simple step will mean there is a long-time before there is a return on the time spent. The suggestion by @Gidi worked perfectly. I have several other buttons to click so will have to figure out how copy this method or revert to key presses.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard