Micro Focus QTP (UFT) Forums
Runtime Object Identification Problem - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Runtime Object Identification Problem (/Thread-Runtime-Object-Identification-Problem)



Runtime Object Identification Problem - qapandit - 06-19-2013

First of all I am very happy finding this awesome forum!! My first dsay and first post!!!


Anyway, Let's jump into the problem!

In one of QTP Scripts I have to add one row in each iteration in a Web-Table. I will have to add 1000 rows in this way, so 1000 iterations!!OMG

Problem is that in each newly added row there are multiple Objects (Edit box and List). I need to perform action on all objects in each row. Please see below screen-shot.
[Image: 1.png]


I had the same kind of problem last week. But only one weblist was being added in each iteration. I wrote the following code.It works fine.


Code:
Browser("...").Page("...").Link("AddRoles").Click

Set Desc = Description.Create()
Desc("micclass").Value = "WebList"
Set Lists= Browser("...").Page("...").WebTable("Roles").ChildObjects(Desc)
Lists.Count
Max = Lists.Count -1

For x = 1 to Max
Lists(x).Select "....."
Next

Browser("...").Page("...").WebList("....."). Select "......"
End If


But in today's scenario in each iteration multiple objects are being added (Edit box and List) in the run. I am confused how to identify them individually. Please help Gurus.


RE: Runtime Object Identification Problem - qapandit - 06-19-2013

Did I do anything wrong? Still nobody is shown up witht he solution. Come on guys! Please help.


RE: Runtime Object Identification Problem - basanth27 - 06-20-2013

I see that the list box and the Edit boxes properties may remain same. Why dont you use the index property to identify them for each row and then fill the data?


RE: Runtime Object Identification Problem - Sathiya - 06-20-2013

hi,
Hearty welcome to QTP world.....

it would be great if you share the object spy screenshots so that we will analyse in depth.


RE: Runtime Object Identification Problem - qapandit - 06-21-2013

I analyzed Object properties. There is no index number. id is very inconsistent. Is it possible to do something with creation time like Browser creation time?

Can I modify my code (in main post?) for this scenario?


RE: Runtime Object Identification Problem - qapandit - 06-21-2013

(Please see the Image in main post)

The only difference I see in the edit boxes of first row (*Claim*) is increamental id. For each newly added field id values increaments. Please see the image below.

[Image: id.jpg]

Now is there anyway to handle this?


RE: Runtime Object Identification Problem - basanth27 - 06-21-2013

You could use the iteration number to be passed as a parameter to the object. that way for each loop it will substitute the number and move to the next one.

Eg:
Code:
for i = 0 to 10
  claimsid&i....
Next



RE: Runtime Object Identification Problem - Ankur - 06-21-2013

Just to clarify, index no. won't be available in the spy. You can use them to identify objects using Descriptive Programming.


RE: Runtime Object Identification Problem - qapandit - 06-29-2013

Please see one of the the ids below. Bold (0) gets changed in each iteration.
NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:0:BulkInvoiceItemsLV_ClaimNumber

Numbers will be increased 0 to 1000. It is in the middle of the string. How I can put a increamental loop their?


Let me give a try Ankur. Thank you so much!

Hi basanth27 and Ankur. Thank you for your help. You guys are awesome! I am sorry as I am pretty new in QTP.

The Ids for for 1st, 2nd and 3rd Editbox are

Code:
NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:0:BulkInvoiceItemsLV_ClaimNumber
NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:1:BulkInvoiceItemsLV_ClaimNumber
NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:2:BulkInvoiceItemsLV_ClaimNumber

So This is how I am trying for the 1st one

Code:
For z= 0 to 1000

id1st="NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:"
id2nd=z
id3rd=":BulkInvoiceItemsLV_ClaimNumber"

ClaimNumberId=id1st&id2nd&id3rd

Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("html id:=ClaimNumberId").Set ""
Next

Please help me out.


RE: Runtime Object Identification Problem - qapandit - 07-02-2013

Hi Guys! I could solve it. here are the codes

Code:
For z=0 to 999

Set Amount_Field=Description.Create
Amount_Field("Micclass").value="WebEdit"
Amount_FieldId_1stPortion="NewBulkInvoiceDetail:BulkInvoiceDetailScreen:BulkInvoiceItemsLV:"
Amount_FieldId_2ndPortion=":BulkInvoiceItemsLV_Amount"
Amount_Field_html_id=Amount_FieldId_1stPortion&z&Amount_FieldId_2ndPortion
Amount_Field("html id").value=Amount_Field_html_id

'Set Amount
Browser("ClaimCenterBrowser").Page("ClaimCenterPage").WebEdit(Amount_Field).Set Str_Amount
Browser("ClaimCenterBrowser").Page("ClaimCenterPage").Sync
Set ClaimNumber_ID=Nothing

Next

Thank you again