How to set a selector for click, if indication is not possible

Hello,

I have the problem that an indication of the website, where I am trying to click a button is not possible. It always selects the whole website and does not let me select a part of it.

I was able to set a selector for a button called “Export”, which has the following Code if you inspect it:

<button class="MuiButtonBase-root MuiButton-root MuiButton-outlined jss608 jss668" tabindex="0" type="button" data-test-id="tab-export-button" aria-disabled="false" style="margin-bottom: 10px; padding: 5px 6px 5px 13px;" uipath_custom_id="4"><span class="MuiButton-label">Export<svg class="MuiSvgIcon-root jss47 jss669 MuiSvgIcon-colorPrimary MuiSvgIcon-fontSizeSmall" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg></span><span class="MuiTouchRipple-root"></span></button>

The selector with > <webctrl aaname='Export' tag='BUTTON' /> works

Now I want to select a button, which appears after pressing the above mentioned button and it has the following inspection code:

<li class="MuiButtonBase-root MuiListItem-root MuiMenuItem-root jss549 MuiMenuItem-gutters MuiListItem-gutters MuiListItem-button" tabindex="0" role="menuitem" aria-disabled="false" data-test-id="export-portfolio-all">All<p class="MuiTypography-root MuiTypography-body1" data-test-id="export-portfolio-all-number" style="margin-left: 5px;">(5030)</p><span class="MuiTouchRipple-root"></span></li>

I can not find out how to select the last button, without indication

Hi @titatarik ,

  1. Add a “Click Text” activity to your workflow.
  2. In the properties of the “Click Text” activity, set the “Selector” property to the selector of the button you used before, which is <webctrl aaname='Export' tag='BUTTON' />.
  3. Set the “Text” property of the “Click Text” activity to “All”, which is the text content of the button you want to click.
  4. Run the workflow.

Happy Automation, Cheers!

@titatarik

You can try using <webctrl tag=‘LI’ data-test-id= ‘export-portfolio-all-number’ />

This looks static…

Cheers

1 Like

This works perfectly. Thanks!!
Do you recommend using webctrl tag and data-test-id as selectors in generall for cases where an indication is not possible?

@titatarik

Tag is definitely reliable…and coming to id …if they are static text then yes…if they contain some numbers then better to try with wild card on numbers and some static text…for this case as it is static text we can use it

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.