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
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
How can get count of list box?
What test cases can you automate using QTP?
When do go for loop condition in test?
Which features or drawbacks of QTP lead to the upgrade for a newer version?
Can UFT be connected to Quality Center? If ‘Yes’ brief the process or steps.
in a web page How to check and display a particular word from a paragraph?
Discuss the QTP Environment?
I used child objects to get the no of weblist present in the weblist.now i need to select the items present in each weblist ?How to do so
How to check which add-ins are associated with a test in qtp?
What is the difference in the global and action sheet in qtp?
Is any limitation to xml checkpoints?
In the Hybrid framework, data can access the database, excel file, XML etc. Is it true?
When Recovery scenario actually starts while testing the application?
How can you identify the browser and its information using QTP script?