write script for finding number of broken links in web page?

kindly please answer my question.

Answers were Sorted based on User's Feedback



write script for finding number of broken links in web page? kindly please answer my question...

Answer / pavani prasad

Thank u Lakshmi for responding my question.
But i asked about broken links,
u r script is for total links.
i want script for only broken links.

Is This Answer Correct ?    3 Yes 1 No

write script for finding number of broken links in web page? kindly please answer my question...

Answer / pramila

Using Automatic Page checkpoint:
Go to Tools > Options > Web > Advanced and check the two
boxes labeled “Create a checkpoint for each page while
recording” and “Broken Links”.
Now every time you record a new page, QTP will automatically
include a checkpoint for broken links.

OR

By manually creating a Page checkpoint:
QTP does not provide a direct menu option to incorporate a
page checkpoint. You need to take the help of standard
checkpoint. Start recording session > Insert > Checkpoint >
Standard Checkpoint (OR press F12). Place and click the hand
pointer anywhere on your web page from "Object selection-
CheckPoints Properties" window click OK it takes you to
"Page checkpoints Properties" where in click on 'Broken
Links" option.
Run the above script. Go To Test Results > Your Check Point.
Check the status of all links under “Broken Links Result”
If you want to verify links pointing only to the current
host check the box titled “Broken Links- check only links to
current host” under Tools > Options > Web. Similarly If you
want to verify links pointing to other hosts as well,
uncheck it.

Is This Answer Correct ?    0 Yes 2 No

write script for finding number of broken links in web page? kindly please answer my question...

Answer / lakshmi

To find no:of links present in any open web page:-
************************************************

dim br,pg,objbr,objpg,linkcoll,lcount
br=Browser("micclass:=Browser").GetRoProperty("name")
pg=Browser("micclass:=Browser").Page("micclass:=Page").
GetRoProperty("title")
set objbr=description.create
set objpg=description.create
set odesc=description.create
odesc("micclass").value="Link"
objbr("name").value=br
objpg("title").value=pg
set linkcoll=Browser(objbr).Page(objpg).ChildObjects(odesc)
lcount=linkcoll.count
msgbox lcount

Try it...

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More QTP Interview Questions

How to find the name of the machine where you are running your automation scripts in qtp?

0 Answers  


Our company is having a windows client server application developed in vb.net. so there is a treeview and i am not in a position to record the click events in QTP. so kindly help. Vivek

0 Answers  


Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?

0 Answers  


How many ways we can parameterize data in quicktest professional (qtp)?

0 Answers  


How to Display last item of a Combobox by using QTP?

10 Answers  






There are some links on the page,count and click those links and check the text on the page displayed on clicking the link.write script for this scenario.

0 Answers  


What are the key points to create a framework in QTP for oracle forms?

0 Answers  


How can you write the scripts that operate on different objects depending on run-time information?

0 Answers  


Synchronozation types in QTP

11 Answers  


Plz give the vb script for the following scenerio I have faced one issues while doing test in QTP. I have described the scenario below. 1. I have to test web application.In that i want to select from the drop down values in the application. 2. Suppose Drop down has 5 value "A,B,C,D,E".I would like to give value from data table of QTP. 3. For every iliteration it should select A,then B and so on

0 Answers  


Which object repository we use in real time and can we merge 2 object repostiory and how?

6 Answers   HCL, Satyam,


How to capture checkbox properties when properties of the object keep changing on relogin to the application.

0 Answers   TCS,


Categories