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 to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me

12868


How will you compare two strings in vbscript?

592


Mention the rules for using option explicit statement?

480


Which operator can be used to do an xor operation in vbscript?

676


what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?

1430






What is the use of the date function in the vbscript language?

556


Explain the scope of the variables using dim, public, and private keywords respectively.

715


after medical test,when will be the police verification

1709


What aspects of vbscript make it safe so that a web page using vbscript cannot destroy or corrupt information on a user's computer?

575


Hello Guys, If any body looking for "worksoft certify tool training in bangalore", please contact me aimansaud@gmail.com

1041


Which operator can be used to change the value of the operand or change the state of the condition?

569


Explain about scrrun.dll in vbscript?

644


Write a Program to add 2 numbers without using operators (+,-) and without using third variable. Note: Use VBScript only Hint: You can use other operators like '/' & '*'(Division & Multiplication)

3182


How will you get the natural logarithm of the given number in vbscript?

599


why variable name should not exceed 255 characters?

1813