There are several checkboxes on the page with the same attributes. I used UseKeys = True, GetClones and a ListLoop for iteration over these elements. However, I need to perform a click action on only two of these elements. How can they be accessed from a list?
GetClones result gives me a cloneCollectionProxy, I am not able to extract a particular web element (the result of cloneCollextionProxy.GetItem(name) is iElementProxy). I would like to extract an element and use a PerformClick method on that element.
@KONSTANTIN Serditov The thing is that these elements are vitrually identical so there's no way to differentiate them. If I want 5 elements out of a list of 13 elements then I would need to add 5 conditions for an interator with true and false outcomes which would make the automation very hard to manage and maintain.
Is there any way in Pega Studio to create a list of web elements and perform operations on such list other than looping?
Posted: 1 year ago
Posted: 10 Feb 2021 10:50 EST
Thomas Sasnett (ThomasSasnett)
Lead Robotics Architect
@KasiaM40 You will have to have a means to differentiate them at Runtime given that you have match rules that includes all of them. What are you using within the control to determine it is one you need to check?
As for accessing the list of elements, the GetClones method returns an array of those elements. You can use C# to access elements in that array if you'd prefer (via a script), but the easiest method for accessing them is to use a ListLoop. Unless you have hundreds of items in the list, the loop should be just as timely. The array isn't specifically ordered, so you wouldn't want to assume that element 0 is the first one on your page for example.
Posted: 1 year ago
Updated: 1 year ago
Posted: 11 Feb 2021 6:07 EST Updated: 11 Feb 2021 9:29 EST
@KasiaM40 The list is really ordered by how they are matched. Since there's no contract stating the matching order, you'd need to examine the items in the array to find the one you want. Another option you could use is to set a known key on each element as it is created by examining its properties to assign it a key. For example; a hyperlink might appear inside a table cell inside a table row. That table row might have an attribute assigned by its developer that indicates its row index. You could use that is the key for the control. Then when you needed to access item number 2, you'd provide that as the key. This would avoid any iteration.