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 / Dynamic Selector (vari...
Power Automate
Answered

Dynamic Selector (variable in selector) in Desktop Automation

(2) ShareShare
ReportReport
Posted on by 39

Hi fellow users,

 

Has anyone found a solution to use "variable" in the selector?

For instance, the application may have a table, to click and type into the table, I need the index of the row and column.

Thus it would be nice to create a variable to help to point to the row that I'm about the click.

 

I've tried referring the variable using %var%, but it won't work.

 

BR

Helliton

I have the same question (0)
  • Verified answer
    adijain Profile Picture
    Microsoft Employee on at

    Hello @HellitonWoo,

     

    Variables can be parsed in CSS and UI selectors in Power Automate Desktop. To do that please follow the steps below:

    • Search for the element that needs to be edited in the UI elements pane, right click on the element and go to edit selectors.
    • Navigate to the selector builder which can be used to easily customize the selector and click on "custom" toggle button.
      • adijain_4-1602615199374.png
    • Now for your case you would need to parse the variable %var_row% in the table selector attribute. e.g. shown in the screenshot below:
      • adijain_6-1602615373965.png

         

    Hope the above helps. Please let us know the target selector path and variable name to be parsed if you encounter any issues. Thanks!  

     

     

     

  • HellitonWoo Profile Picture
    39 on at

    @adijain 

    Thanks for the answer!

     

    This is the selector, and the way it worked exactly as explained:

    window[Class="#32770"][Name="New Invoice"] > list[Class="SysListView32"] > listitem[Id="ListViewItem-%row_nr%"] > text[Id="ListViewSubItem-%col_nr%"]

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi

     

    I struggled a bit with using a dynamic selector as well untill I understood that in order for it to work, "Custom" HAS to be toggled 🙂 

     

    Best Regards

    Mikkel

  • Kevin77 Profile Picture
    2 on at

    Hi Guyz,

     

    Please help to solve this dynamic selector div[Id="screenarea2.B10"].

    Kevin77_0-1625746315237.png

     

  • adijain Profile Picture
    Microsoft Employee on at

    Hi @Kevin77, you can customize the selector to this: 

    iframe[Id="application-Shell-startGUI"] > div[Id^="screenarea2"]

     

    this can be done either by hitting the custom button or changing the div's Id attribute operator to "Starts with"

  • RiiG Profile Picture
    21 on at

    Hi

     

    can variables be used in attribute names?

    this didn't work.....

    Screenshot 2022-06-30 084614.png

  • RiiG Profile Picture
    21 on at

    is there any way to remove the quotes from around the variable in the selector above? 

  • Niraj466 Profile Picture
    73 on at

    I'm also facing the same issue. Variable used as Value for Attribute, it looks it doesn't work. 

     

    Niraj466_1-1665477230689.png

     

  • RiiG Profile Picture
    21 on at

    sorry i cant help with your specific question!

    but I managed to do what I wanted (message 7) without using the Visual editor

    good luck

    Screenshot 2022-10-11 112102.png

  • Niraj466 Profile Picture
    73 on at

    Anyone can have idea, why the attribute name "Ordinal" is not displaying in "Preview selector". Is this a bug here or I'm missing anything?

     

    Niraj466_0-1665506426620.png

     

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 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard