2

I am new to UIPath tool. please accept my apologizes if it's a poor question.

I need to click\sendKeys a web element, which is totally a dynamic element. ID will keep change for everytime when loading the page.

Login 1: <span id="x58Sn0-cnt" class="z-tab-text" uipath_custom_id="8">Update</span>

Login 2: <span id="nT9Tn0-cnt" class="z-tab-text">Update</span>

Note:
Also we can't relay on class "z-tab-text" because so many other elements are sharing the same class.

thanks in advance. :)

  • 1
    What about the -cnt part in both IDs? – Morris Miao Jul 05 '17 at 04:35
  • @MorrisMiao The IDs looks like something that gets autogenerated, not saying they are - just looks like it. – Nicolai Krüger Jul 05 '17 at 07:47
  • @Rojer Feds, Could you provide a link or more HTML and maybe also an image of the page. UiPath have som pretty nice image capabilities? – Nicolai Krüger Jul 05 '17 at 07:48
  • 1
    @NicolaiKrüger if you can see all of them in a form ending with "-cnt" then you may probably use wildcard characters in your selectors e.g. *-cnt, and you should be able to get them. – Morris Miao Jul 05 '17 at 07:50
  • @NicolaiKrüger another way is to use OCR-type activities, find the positions of "Login", and to use relative position to find the text box where you want to put your texts in. – Morris Miao Jul 05 '17 at 07:54
  • @MorrisMiao yes, it might be possible that the only the login ids end with "-cnt", but not sure. That's why I have asked for more info (HTML/link and an image). – Nicolai Krüger Jul 05 '17 at 14:34

3 Answers3

1

You may refer to the parent elements in order to get the right selector, for this you should be using the css-selector property instead of considering the id html attribute. For instance, let's suppose the dynamic element is always the first child of a div, then you could use:

<webctrl css-selector='div span:first-child'/>

The syntax for the css-selector property is the same as used in element selectors in CSS sheets for HTML files.

Just to comment, you can also find more tips and discussion in UiPathForum, which is full of knowledge and discussion about specific implementations on this tool.

brunoazev
  • 96
  • 6
0

I've managed this usecase by using idx

I know it's not recommended for failing cases i'll go with image. Now it's fail free.

0

You will likely need to use a combination of the wildcard operators(*, ?) and maybe the aaname(text) attribute by the looks of it. maybe something like this:

<webctrl id="*-cnt" aaname="Update" />

Wildcards: If there are parts of your ID that will always be the same, then at least the wildcard in the selector will help somewhat in the selection process.

Asterisk (*) – replaces zero or more characters

Question mark (?) – replaces a single character

UIPath Selectors with Wildcards Documentation

I would recommend going through the Foundation Training for UIPath as it seems to help quite a bit and it is free. Honestly, though, it is my opinion that RPA is not perfect for every web application use, especially when there is highly dynamic HTML and unreliable selectors. Angular & Knockout apps are great examples. Many time Angular uses javascript objects instead of specific IDs and data-attributes, which UIPath does not have access to, so this creates an environment where you have to get creative with selecting selectors that will work. It also means that those selectors will break with any little code changes.

MUlferts
  • 1,310
  • 2
  • 16
  • 30