How to capture dynamically changing data in web page through scripting in QTP along with any sample working code

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

3 comments:

Anonymous said...

we can also capture unread email accounts by splitting first with "(" and then split with ")" and the first value in second split will be the number of unread emails.

Kanikaram Kiranpaul said...

you can try that one also. there are different approaches for this. You can put your script here.

crushed velvet sofa covers said...

The Collection Marts is platform where you can view latest designs about home décor and bedding. We have large range in different categories with finest fabric in cotton and silk. You can view not only present trends but also view huge collection with reasonable price. The Collection Marts can provide fast service about delivery as well as customer support too. Our products are not only self-made but also, well connected with markets to ensure for possibility of available designs if client want to purchase. The Collection Marts customer support open 24/7 to guide their customers about material or product stuff. kids waterproof mattress protector , cotton razai cover

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */