How to write a general script which should does the
following
a). If a page object is given, it should identify the page
object of the corresponding page(site).
b). It should identify all the links of that particular
page.
in QTP tool?

Answer Posted / arun

if page object is given then..

eg> set pgObj = browser(yahoo).page(yahoo)
pgObj - is the page object

Answers:
1. we can check for the page as follows
tmpPageName = pgObj.getroproperty("name")
if tmpPageName = "Yahoo" then
msgbox "Found the page"
else
msgbox "Page Not found"
end if

2. Need to use description.create function

set descObj = description.create
descObj("micclass").value ="link"
set lnkObj = pgObj.childobjects(descObj)
msgbox lnkObj.count '// This will give you number of links
found in that page

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you get the smallest subscript of an array in vbscript?

807


What is loose binding? Why is it not a good practice to use it?

633


Explain about tristate constants in vbscript?

614


How will you format a number in percetage format in vbscript?

589


what types of bugs will we find out in banking projects for automation testing?

1764






Program to use input box and send even numbers into sheet1 and odd numbers into sheet2 and prime numbers into sheet3 using vbscript(QTP)?

2587


Mention how to assign a date value to a variable?

585


What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?

487


Explain about adodb.stream class?

587


What is the use of the recordset object and which statement is used to create such an object?

527


Mention what is select case statement?

544


Explain about .wsf files?

618


How to assign a date value to a variable?

589


What is the use of option explicit statement?

583


Which date function is used in the vbscript language to find the difference between the 2 dates?

589