For example, how to get URL "http://motevich.blogspot.com" from the following browser:
There are two solutions:
- Using GetROProperty("URL") method (run-time object property)
- Using "URL" property of "Object" (IE DOM Object)
- GetRoProperty("URL") method (run-time object property)
GetRoProperty function reads properties of a run-time object in an application.
If you open QTP Help on GetRoProperty function, you 'll see that this function can work with all objects:
So, for example:- to check whether a link is visible or not, use:
Browser("bname").Page("pname").Link("lname").GetROProperty("visible") - to get a page's title, use:
Browser("bname").Page("pname").GetROProperty("title") - to check whether a window is maximized, use:
Window("wname").GetROProperty("maximized") - to get width of WebButton, use:
Browser("bname").Page("pname").WebButton("btname").GetROProperty("width")
In our case, to get URL of the current WebPage, we will use:Browser("bname").Page("pname").GetRoProperty("URL")This is a sample QTP script: - to check whether a link is visible or not, use:
- "URL" property of "Object" (IE DOM Object)
The sample syntax is:Browser("bname").Page("pname").Object.URLActually, this is Internet Explorer Document Object Model (DOM) Object.
What is "Object" in the above statement?
You can read more about DOM here and here.
Also, I recommend to read this interested article on working with IE DOM from Visual Basic.
Tip: You can use DOM Object when running QTP test on Internet Explorer only!
To make the long story short, I can say that using Object property you can get almost all elements and properties from Web page.
Thus, I use URL property of Internet Explorer's DOM Object.
All properties, collections, and methods of DOM Object are described in this MSDN article.
Tip: The number of properties, accessed via DOM Object, is more bigger, than properties accessed via GetROProperty method.
So, the result of above code is:
Two ways were discussed:
- GetROProperty("URL") (run-time object property)
- "URL" property of "Object" (IE DOM Object)
Both can get URL of the current Web page.
Related articles:
- QTP VIDEO - How to capture dynamic text
- QTP - How to get font size/color, background color and other attributes of controls
- QTP - How to capture tool tip?
- QTP - Capturing tool tips of images
- How to record QTP script - VIDEO tutorial
- QTP Descriptive programming - processing images
- How to minimize/maximize QTP window before the QTP script execution
- All QTP visual tutorials
Have you got interested materials or your own thoughts on QTP (QuickTest Professional)?
Let's share them and help each other to improve our skills and knowledge!
You can send them to my email:
Thank you in advance, dear readers.
--
Dmitry Motevich
4 comments:
Hi,
It is really helpfull to have these small programs which give us an insight of scriting manually. I found you site today I managed to go through all articles. They are very brillient & it helps a lot for beginners like me. I have few requests for you.
1) As you have suggested 10 steps to become QTP GURU, could also please come up with such things to master LoadRunner Scripting
2) Also could you please publish articles for scripting manually with simple programs (a) QTP (b) Load Runner - i have managed to script for QTP very small programs but for Load Runner I am still trying to program from scratch. I just have no idea from where to start
(3) Regarding LoadRunner, I have few questions in monitoring.
(a) what effect does apache max clients settings have on system as a whole? - I know that it sets the maximum number of users for sessions but have no idea of this inner architecture. What are other the parameters(like max client settings, tomcat instances, keep alive from load balancer). I here these stuff but has no idea from where to start to get indepth knowledge of these. Could please provide an overview of these terms & how do they relate with monitoring. Also Could you please brief up about what actions should be taken if find issues with memory being used up, %cpu crosses 75
This will help us a lot & i thank you from the bottom of my heart for giving us your valuable knowledge and time on these tools.
I will be waiting for your next posts.....
Thanks
@Anonymous,
1) Yes, I put this article into my "queue"
2) Hm... Could you suggest me topics for such small articles for QTP & LR?
3) Please send your questions to LoadRunner group
Hi Dmitry,
Thanks a lot for your great work. It helps people like me who are looking forward to learn QTP.
SRV
Thank You Dmitry. You are doing a great job.
Post a Comment