In QTP 12.51, how to identify dynamical element generated using ajax/jquery form?

171 Views Asked by At

In my Datatable three rows present.After clicking on Add button new row is generateed and i need to put input values from datatable.

Problem : How to identify field of each row dynamically for inserting values?

Script:--

    Datatable.GetSheet(5)
    rowcount=Datatable.GetRowCount
    For i=1 to rowcount
         Datatable.SetCurrentRow(i)
         lenth =Datatable.Value(1,5)
         width= Datatable.Value(2,5)
         height= Datatable.Value(3,5)
         weight=Datatable.Value(4,5)
         piece=Datatable.Value(5,5)

Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info1[length_val]"Set lenth Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info1[width_val]").Set width Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info1[height_val]").Set height Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info1[weight_val]").Set weight Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info1[total_pieces]").Set piece

In this script,

Here for first row, web element name is "ship_info1[height_val]"

for next added row, web element name is "ship_info2[height_val]"

So, I want to select this web-element dynamically. Please see the attached image.

enter image description here

1

There are 1 best solutions below

1
On BEST ANSWER

try code something like below

temp=1
     temp=temp+1
    Browser("Magma MCR").Page("Magma MCR").WebEdit("ship_info"&temp&"[length_val]").Set lenth 

By the way, does QTP idetify that table in your application as web table?