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 integrate the qualitycenter with qtp

0 Answers   Wipro,


Do we have to Enable Smart Identification while running Or will it automatically be enabled ?

2 Answers  


Is there anyone can tell me where I can download free or trial QTP? I tried HP website, it was not there anymore. If someone know, pls send me URL. Tks...

1 Answers  


Can any one please list me out the shortcut keys for some functionalities in the QTP .. for example ..to record...to run...etc

6 Answers   Keane India Ltd,


Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance

0 Answers  






I have 14 itmes in a drop down that are associated with an account And these items change with different accounts I want to be able to define it by and index number or any other id so if I enter 2 in my Global excel sheet it selects the 2nd item from the drop down - is this possible?

5 Answers   Rogers,


What are the common defects found in your project? (in qtp interview)

0 Answers   TCS,


what is difference between normal mode and fast mode?

1 Answers  


HI, pls help me on this, iam not able to capture getcelldata value in javatable... msgbox javawindow("").javatable("").getcelldata(3,3) but it diaplays empty...

0 Answers  


HI All i need one suggestion.is there any companies taking corresponding degree courses. i have 3+ yrs exp in QTP and i am working north side. iam looking for job in south.

1 Answers  


How do know the number of browsers opened?

0 Answers  


When I start recording any web application (either Mozilla or IE) QTP recognizes window instead of browser and also it does not show all the hierarchy tree of that particular web page. 1. Window("Mozilla Firefox").Check CheckPoint("Mozilla Firefox") 2. As everybody knows it should be browser("Mozilla Firefox").Check CheckPoint("Mozilla Firefox") I am using the windows vista, do you think it may be a problem of my settings in QTP or problem of my installation. Your kind responses will be appreciated. Thanks in advance. Satya

12 Answers  


Categories