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

How to remove the associated function library?

532


how do you parameterize search button from the website? the page is a single winobject and i have made a virtual object button of search button but search box can't be converted into a winedit and if we try to convert it into winedit the value we enter in a searchbox appears as numbers in the script so we arent able to parameterize.help!!!

1740


what is the difference between data driver & data driven and driver script?

2143


How can I open a EXCEL file from QTP Resultviewer with reporter.ReportEvent function call. Example: Test files for details click "here". And clicking "Here" in the resultviewer will open a local EXCEL FILE.

1819


hai, i completed my b.tech in 2010 with 62.3%. i having knowledge on manual testing and Qtp. i want Relavent experience in testing.watever may be d salary i dont bother..I just want to gain knowledge. i dont have good communication skills.

1426






What is parameter in qtp?

682


Suppose I created one object as virtual object? That object is applicable to that test? Or all the tests?

568


How do you configure QTP AND Test director?

1502


What is the file extension of the code file in qtp?

563


when I try to run below script in QTP "totalPages" value is 2. But i am getting error message (Type mismatch: 'totalPages' Line (): "For i=1 to totalPages".) totalPages=Browser("Name:=User").Page("Title:=User").WebElem ent("innertext:=of.*").GetROProperty("InnerText") msgbox totalPages For i=1 to totalPages rnum=Browser("Name:=User").Page("Title:=User").WebTa ble("column names:=User Name;ID;Last Name;First Name").GetRowWithCellText("store4") If rnum>0 Then r=rnum Exit for End If Browser("Name:=User").Page("Title:=User").WebElement ("html tag:=A","x:=471").Click MsgBox "Exit" Next

3281


What is the extension of QTP local Repository? If it is .mtr then what is .bdb extension stands for?

586


Hi , I am facing issue QTP 10.0 with oracle ERP 11i .When QTP opens,click sub links on ERP ,FORM is not opening getting unexpected Internet explorer error message with send or don't send report.So unable to work with forms using QTP.

3423


can the activities of test case design be automated?

1456


any body can you help me what is the script to automate an comand promt

1980


What is checkpoints for quicktest professional?

551