cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HellitonWoo
Regular Visitor

Dynamic Selector (variable in selector) in Desktop Automation

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

1 ACCEPTED SOLUTION

Accepted Solutions
adijain
Microsoft
Microsoft

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!  

 

 

 

View solution in original post

5 REPLIES 5
adijain
Microsoft
Microsoft

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!  

 

 

 

View solution in original post

@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%"]

 

 

MikkelRønde
Frequent Visitor

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
New Member

Hi Guyz,

 

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

Kevin77_0-1625746315237.png

 

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"

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 (1,538)