Dynamic object ID


#1

Hello,

I have an object with ID

input_Length_billerDetailSubviewidbillerDetailFormIdbillerDetailDataTableId0j_id_jsp_195573338_107pc160j_id_jsp_195573338_109pc16

I have to input some text value for this field. I have gone through the existing discussions on dynamic object IDs and know how to handle till "input_Length_billerDetailSubviewidbillerDetailFormIdbillerDetailDataTableId0"

what should i do with the rest, j_id_jsp_195573338_107pc160j_id_jsp_195573338_109pc16? as this is a random ID. Please suggest.

Thanks,
Neethu


#3

Can you share an example of the HTML for the element, as well as a few of its parent elements?


#4

Hello @Brandon_Hein,

please find the following
image

In the above table, the account number and length field can be defined multiple times. For each entry the field will have a dynamic id. Please let me know if any further details required.

Thanks,
Neethu


#5

Oh, since it’s within a table, I would forget trying to identify the input by any attribute, and just identify it by it’s location in the table. In the below xpath, you can replace the index within the <tr> and <td> elements to match the row/column you are trying to target. I’ve set them to row 1, column 1:

//tbody//tr[1]//td[1]/input

If there are multiple tables on the page, you will instead need to better identify the table you are working with. Otherwise, this approach should work fine.


#6

Hello Brandon,

I have tried to identify the field with x path position as shows below; however it shows 9 elements with the same position while i use object spy.

Any thoughts?

Regards,
Neethu


#7

My guess is that there are a bunch of nested tables here. Can you check the following xpath in object spy?

//table


#8

Hello Brandon,

Now I am able to identify the field using the xpath position;

//td[10]/table[1]/tbody/tr/td[1]/input

for each entry, table count need to increase for e.g //td[10]/table[2]/tbody/tr/td[1]/input , //td[10]/table[3]/tbody/tr/td[1]/input etc.

Thanks for the help,
Neethu