Dynamic selector

selector

#1

Dear all,

my task is to loop through several rows in a table of an application.

The tricky part is, that the indexing of this app is dynamic. This means that sometimes the first row of the table has a selector containing e.g. virtualname=‘VCheckbox7246’ />, but sometimes it is virtualname=‘VCheckbox11’ />.

However, next rows are always +1. Is there a way how to investigate what the selector of the first row is as I am not able to click on it?


#2

Hi @mario,

First get the Number using the get attribute activity

pass the selector “virtualname”
So you can get strResult : VCheckbox11 or VCheckbox7246 , etc
To get the number exactly split the string
intStartNumber=Convert.ToInt32(strResult.Replace("VCheckbox",""))

so you can pass the dynamic selector like\

virtualname='VCheckbox"+intStartNumber.ToString()+"' />

after each row you can increment the value.
intStartNumber=intStartNumber+1

Regards, Arivu :slight_smile:


#3

Hi,

But how should I get the attribute if the robot is not able to click on the field when the attribute changes.


#4

Hi @mario,
To get attribute Name follow the below instructions
Use Get Attribute Activity.
Selector : virtualname='VCheckbox*' />
Attribute Name : “virtualname”


Regards, Arivu :slight_smile:


#5

Hi @arivu96

Thanks a lot for your help :slight_smile:

However, How do I know that by using asterisk, the robot will be getting virtualname from the first row, not from the fifth.

thx