How to capture dynamic objects in qtp like mark up text

Answer Posted / deven

To capture the value of a dynamic object in a web
application GetROProperty method is executed. In order to
capture the value of an object and that too of a dynamic
object then we will use the GetROProperty which means Get
Run Time Object Property and we need to decide which
property we want to capture. This can be text innertext etc.

I would list down a sample code for gmail to count unread
emails from any account.

Since the inbox count is dynamic and ever changing from
account to account i have used descriptive programming so
that this piece of code can be run for any gmail account.

The prerequisite is that you log in to your gmail account
and then run this script

This script prints the number of unread emails in the inbox.


inboxcount = Browser("title: Gmail.*").Page("title:
Gmail.*").Link("innertext: Inbox.*").getroproperty
("innertext")
If inboxcount = "Inbox" Then
Print "No Unread Emails"
ExitAction

Else

emailcount = replace(inboxcount, "Inbox","") 'replaces
inbox with space
emailcount = trim(emailcount) 'removes all the spaces
emailcount = replace(emailcount, "(","")
emailcount = replace(emailcount, ")","")

Print "You have "&emailcount& " unread emails in your inbox"

End If

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain types of descriptive programming?

582


What is the Difference between test object and run time object?

598


Hi Friends, How many types of Data Bases available in market... What is the diff. while using Syabase and Oracle in a Project... ? and what is the main diff. of Syabase and Oracle databases... ? Thanx in advance..

1507


Is there any pdf or online book for QTP Scripting? Let me know more about QTP Scripting.

2416


How do you test the text displayed in the header portion of times of india epaper. Hot news(banner) are scrolling in the top of the page, how do you test using QTP?

1496






What is the registration process and examination fees?

543


what is Property......End Property loop? how to write sript for it in QTP

1880


Describe synchronization point.

567


Could i know how how to explain keyword driven framework in interview? If any body knows plz send the explanation.

1603


How many tabs are available in debug viewer pane?

634


How reliable are the site's Internet connections required to be? And how does that affect backup system or redundant connection requirements and testing?

691


I had installed QTP 9.2. It is working fine but whenever I open QTP, it is trying to reinstall the below-mentioned files again and again "QTP92PS82UPGRADE.exe", "recogn.dll". If anybody has these files, please provide those files in this site or you can send that files to my mail id also (lravi4u@yahoo.com). If you don't know where the files will be in the QTP, search in the QTP software CD or path of QTP program installed (C:\Program Files\Mercury Interactive\QuickTest Professional)

1444


How does QTP identify an object?

601


What are the different types of functions available in qtp and explain ?

560


what difference between runtime object and text object and what property they have. whether they have same properties or different properties.

1699