GeekInterview.com
Series: Subject:
Question: 17 of 737

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
Asked by: petorstudent | Member Since Jul-2012 | Asked on: Jul 1st, 2012

View all questions by petorstudent

Showing Answers 1 - 1 of 1 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

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.