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

Which scripting language used by quicktest professional?

751


What is system testing and what are the different types of tests you perform in system testing?

881


When and why to use descriptive programming?

813


What is the basic concept of qtp?

777


Explain in brief about the qtp automation object model (aom).

755


Hi Friends, Can anyone help me out in this one? In QTP, I am using Data Driver and want to parameterise multiple values (say 3 values ) for a field. How can I do it using Data Driver wizard? Plz mention it step-by-step. In the end after doing the needful, on opening the Data Driver window, how can I get number (i.e. 3) in the Parameterised column for that particualr value? Thanks a lot in advance.

1666


Can any body please tell me the steps of keyword driven frame work in qtp. My mail is saswat445@gmail.com please send some materials on keyword driven testing in qtp. thanks a lot...

2034


hi can anybody help with an qtp 9.2 license key please. Thanks, Nitesh.

2143


After fixing the bug, the same bug is raising again and again in new builds what we have to do? That bug is high level bug.

6758


How to connect the remote desktop using QTP 9.2 explain the method or procedure?

3053


How should I click on the right click menu objects When I trying to add the object properties to the OR.It is showing only Window(Window).Not all the objects of the window. Also while recording I found No script. How to solve this>.

1761


Can any suggest me what is exposure testing?

1582


What are advantages of test automation?

920


What is difference in global and action sheet in qtp?

848


can anyone tell me what to say in interview when interviewer asks about "tell me about your framework in your project"?

1649