I’m trying to create an IF where a person is removed from an overview based on the name. The overview is on a website and in order to remove the person, a delete button must be clicked next to the name.
The people that have to be removed are stored in a variable. So the variable has to be found, then if it is found, the cross must be clicked. So my question is: how do I ensure that Uipath first finds the correct line with the name and then clicks on the cross next to this name.
Try using selector with a relative text. i.e if your name is next to the x sign.
Then make your relate text dynamic by using the names from the variable if many in a for loop.
Steps:
Use a click activity
Indicate the element on the screen
Now edit the selector using UI Explorer
On UI Explorer top right you have an option to use relative text
Indicate the text which is the name
Your selector should now be updated with the new value
From my experience, you can’t use the Selector Editor to add a variable into the selector. You need to use the Expression editor. Basically, your selector is stored as a string, so you want to edit it while it’s in that format (ie surrounded by quotations)
If you click inside the Selector property, you will see that it is a string surrounded by quotes:
So edit that string. One trick you can do is remove the “<” character first, then when you click the “…” edit button, it will open the Expression Editor to make the edit much easier (remember to place the character you removed back in there though).
The other half is identifying the attribute that contains the words you want to replace with a variable.
Your selector might end up looking like this:
"<webctrl aaname='*"+variable+"*' />"
where I used a wildcard also to make it more robust.