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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,290)