How to get Links count in an web application,without
descriptive programming?
Answers were Sorted based on User's Feedback
Answer / saidev
You can just palce page check point on that page,it will
give you the details like number of images ,number of links
etc in the page.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / chaitu
This Script is Helpfull to count the No.of links in a web
page
Step1: Set Objects = Browser("BrowserName").Page
("PageName").ChildObjects
Step2: Objectcount = Objects.count
Linkcount = 0
Step3: For i = 1 to Objectcount-1
Link = Objects(i).GetROProperty("micclass")
If Link = "Link" Then
Linkcount = Linkcount+1
msgbox Linkcount
End If
Next
msgbox Linkcount ' It show total number links
Is This Answer Correct ? | 7 Yes | 5 No |
Answer / raghava
Hi guys
Here we have to use the description object.Its working with
me.Just try it out.
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Google").Page("Google").ChildObjects
(oDesc)
NumberOfLists = Lists.Count()
linkcnt = 0
For i = 0 To NumberOfLists - 1
linkcnt = linkcnt+1
Next
msgbox linkcnt
Regards
raghava
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / priya
here is an example to get the link count in google page
Just try out this
SystemUtil.Run ("www.google.com")
Set Links = Browser("title:=.*").Page("title:=.*").Object.Links
Msgbox "Total links: " & Links.Length
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / a
POSTED BY -CHAITU
This Script is Helpfull to count the No.of links in a web
page
Step1: Set Objects = Browser("BrowserName").Page
("PageName").ChildObjects
Step2: Objectcount = Objects.count
Linkcount = 0
Step3: For i = 1 to Objectcount-1
Link = Objects(i).GetROProperty("micclass")
If Link = "Link" Then
Linkcount = Linkcount+1
msgbox Linkcount
End If
Next
msgbox Linkcount ' It show total number links
--------------
This code is not working.
Check it out.
Link = Objec(i).GetROProperty("micclass")
Error is here.
Is This Answer Correct ? | 1 Yes | 1 No |
'Hi, we can use "innertext" as a unique property of link.
'Name may be changes in the runtime. And we can use the
index number to identify the link in the execution.
(NOTE:-We dont use index to retrive the child objects.why
because each child object have different index number.)
TRY THIS CODE:--------THIS WIL WORK FINE.
set olink=description.create()
oDesc("micclass").Value = "Link"
set chobj=browser().page().childobjects(olink)
n=chobj.count
msgbox n
for i=0 to n-1
val1=chobj(i).getroproperty("innertext")
msgbox val1
Next
Any doubts----mail to------ mskalyan.smile@gmail.com
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / venkatesh.m
Hi friends,
set odesc=description.create()
set odesce("htmltag").value="a"
set lists=browser("b.name").page("p.name").childobjects
(odesc)
set counter=lists.count
msgbox "total no.of links"& counter
for i=0 to counter-1 step 1
set link=lists(i).getroproperty("name")
msgbox link,0,"curren link is"
Next
The above script works correctly.
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sudhir
Hi Friends ,
Above Ans #5 gives syntax mismatch error.
Find below correct code.
set odesc=description.create()
oDesc("micclass").Value = "Link"
set lists=browser("Welcome: Mercury Tours").page("Find a
Flight: Mercury").childobjects(odesc)
counter=lists.count
msgbox counter
for i=0 to counter-1 step 1
name=lists(i).getroproperty("name")
msgbox name,0,"curren link is"
Next
Is This Answer Correct ? | 0 Yes | 2 No |
Hi we are using QTP9.0 for Seibel Application and this seibel application will give you a popup messagebox which is of web , so qtp takes 3 mins to recognize the messagebox and to click on it , we have more number of messageboxes like this . please suggest me some solution
hi all here i have tab named "Workbench" By clicking on "workbench" tab.it displays 4 tabs like below workbench common cargo commercial charter "common" tab have 10tabs inside,"cargo" tab also haveing 15 tabs inside and remaining two tabs also having few tabs inside. when clicked on "common" tab.it displaying the script like tab("workbench").select"common" if i clicked on "cargo".it displaying the script like tab"workbench_2").select"cargo" if i clicked on "commercial".it displaying the script like tab"workbench_3").select"commercial" if i clicked on "charter".it displaying the script like tab"workbench_4").select"charter" I have used a "FOR LOOP" for common,commercial,cargo,charter tabs.it was stopped at second tab SO, CAN I RECOGNIZE "WORKBENCH_2,_3,_4" AS A SINGLE VARIABLE if not, can anyone plese help me to solve this
where is the bitmap checkpoint be saved
What is the difference between Dim And Redim
4 Answers Hotel Jobs, IBM, Microsoft,
In an application you have a web table. You are provided with an external Excel sheet with the same structure as that of the web table. How will you retrieve all data from the web table and compare it with corresponding data available in the excel sheet, using QTP? How will you report the results in QTP?
Write the vb script for the lowest and highest values of an array?
what is the difference between invoke application and system.util.run
I have enrolled for a QTP course which is a four weekend course.Do you think its a good way to start off learning this tool?What all do i need with me in order to become a pro at using this tool?
.qfl extension for which file? where vl use it
How to test fly out menu in qtp?
can u tell me the the cost of automation tool QTP ?
Hi all, what is the latest version of QTP?