How can I use Childobjects in QTP for Identification of WebElements

I wrote this code:
Set odesc = Description.Create()
odesc.Value("Class name")="WebElement"
odesc.Value("innertext")= JOB JOB is name of Parameter with STRING Value-User defined params.
ex.JOB = "Officemanager".
Set obj =Browser().Page().Childobjects(odesc)
Set obj_number = obj.count
But When I write this code:
obj.GetROProperty("xsx").click ...Then will Error Message
My Problem is, that with this code I can identification 2 WebElements with these properties, but I need just ONE. Pls can you help me?
Thx

Questions by petorstudent

Showing Answers 1 - 3 of 3 Answers

Set obj =Browser().Page().Childobjects(odesc)
Set obj_number = obj.count this count represents the number of objects that are satisfying the description that you have made using description.create().

obj is a collection object of all such objects... you can imagine it like an handler.
you can use the below code for performing action on the first object in the collection

obj(0).click This statement will perform click method on the object.

Please note that the collection index starts from 0 zero.

Hope this answers your question.

Thanks,
Brahma Sagar Gunda

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions