ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Testing >> Automation Testing >> QTP
 
 


 

 
 WinRunner interview questions  WinRunner Interview Questions (496)
 Load Runner interview questions  Load Runner Interview Questions (486)
 QTP interview questions  QTP Interview Questions (3496)
 Test Director interview questions  Test Director Interview Questions (161)
 Rational TestSuite interview questions  Rational TestSuite Interview Questions (106)
 Silk Test interview questions  Silk Test Interview Questions (59)
 Automation Testing AllOther interview questions  Automation Testing AllOther Interview Questions (385)
Question
How to get Links count in an web application,without 
descriptive programming?
 Question Submitted By :: QTP
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
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
Saidev
 
Answer
# 2
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
Raghava
 
 
 
Answer
# 3
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 ?    6 Yes 5 No
Chaitu
 
Answer
# 4
'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 0 No
Kalyan
 
Answer
# 5
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
Priya
 
Answer
# 6
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
A
 
Answer
# 7
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
Venkatesh.m
 
Answer
# 8
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
Sudhir
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
1. Can anyone help me with recovery scenarios, each type with examples and also what is on error resume next?   1
how to retrieve the xml file data through qtp. can anybody send script for this.. Synechron 2
Where we write the FUNCTIONS, in Expert view (or) in any textfiles like Notepad and save it in Library functions folder? How to cal that functions to our script? How to save that functions to Function generator?   3
explain qtp framework by taking an example?   3
QTP Query: Hello to all, I'm getting an error (as below) when I perform descriptive programming on any Web application. "The test run cannot continue due to an unrecoverable error.The "myvar_0" object was not found in the Object Repository. Check the Object Repository to confirm that the object exists or to find the correct name for the object " But I do not have any problem when I perform the same descriptive programming on a Windows application such as Sample Application - Flight. Previosly , I had prepared a lot of scripts - both via creating the properties collection object and by giving the description in string arguments and implemented them on Flight and they're working perfectly fine.I'm using QTP Version 9.2 The sample script I have used for Web application is as below : Set myvar_0 = Description.Create 'Setting property collection object for Browser myvar_0("class").value = "Browser" myvar_0("name").value= ".*" 'Setting property collection object for Page Set myvar_1 = Description.Create myvar_1("class").value = "Page" myvar_1("name").value= ".*" 'Setting property collection object for Text box Set myvar_2 = Description.Create myvar_2("class").value = "WebEdit" myvar_2("name").value= ".*" 'Setting property collection object for Button Set myvar_3 = Description.Create myvar_3("class").value = "WebButton" myvar_2("name").value= ".*" SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe" Browser("myvar_0").Page("myvar_1").WebEdit("myvar_2").Set ("hello how are you ?") Browser("myvar_0").Page("myvar_1").WebButton ("myvar_3").Click Browser("myvar_0").Page("myvar_1").Sync Browser("myvar_0").Close As our application is a Web based application, I was planning to make a few changes in regards to the object names, but unfortunately I am getting the above mentioned error. Could anyone please advice me, whether it could anything to do with the run setting or anything else.I am getting the same error even while implementing on our Sample Application - Mercury Tours website. I would be grateful to anybody who can solve my problem !!   1
How to convert manual test cases to automated testcases TCS 1
IF there are seven browsers with same name open. I want to close one particular browser thru QTP. how can i do this? Polaris 3
can u write one user defined function for webedit class. Cap-Gemini 6
suppose by navigation i went from 1st page to 5th page write a script for coming from any page to the 1st page abd by executing where the page may be . it will come to 1st page give the code using gmail. give me mail id so that i can under this answer with out any doubt   1
hello...any one tell me , where can i get company email id.. actually i am searching on testing... in my CV i put 3+ exp.. but all companies are asked company email id.. please provide solution for that... thanx in advance... HDFC 9
What the differences are and best practical application of each.   1
I have written some script in QTP and i added those objects in Object Repository. All written script has been executed successfully. After few days when i tried to execute the same script i got error message "objects not found in Object Repositiry". How can we solve this issue?   2
 
For more QTP Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com