ALLInterview.com :: Home Page KalAajKal.com
 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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Testing  >>  Automation Testing  >>  QTP
 
 


 

 
 WinRunner interview questions  WinRunner Interview Questions
 Load Runner interview questions  Load Runner Interview Questions
 QTP interview questions  QTP Interview Questions
 Test Director interview questions  Test Director Interview Questions
 Rational TestSuite interview questions  Rational TestSuite Interview Questions
 Silk Test interview questions  Silk Test Interview Questions
 Automation Testing AllOther interview questions  Automation Testing AllOther Interview Questions
Question
Give me some scripts for 1). checking webpage links
(counting links,opening web pages,counting child elements)
 Question Submitted By :: Hprasad
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Give me some scripts for 1). checking webpage links (counting links,opening web pages,counting child elements)
Answer
# 1
' Create object references to the Browser and Page objects.
Set BrowserObj =Browser("Yahoo!")
Set BrowserPageObj = Browser("Yahoo!").Page("Yahoo!")

' Set a description object to identify links.
Set oDesc = Description.Create()
oDesc("html tag").Value = "A"

' Get a collection of links
Set oLinkCollection = BrowserPageObj.ChildObjects(oDesc)
ItemCnt = oLinkCollection.Count-1
' Loop through the link collection
For i = 0 to ItemCnt
    msg = ""
    ' Highlight and click link i.
    Set oLink = oLinkCollection.Item(i)
    oLink.Highlight
    linkText = oLink.GetROProperty("innertext")

    msg = "link text = " & linkText & vbNewLine
    oLink.Click
    BrowserObj.Sync

    ' Read page title.
    titleStr = mid(BrowserPageObj.GetROProperty("title"),1,50)
    msg = msg & "page title = " & titleStr & vbNewLine

    ' Check if page load had error.
    If instr(1,titleStr,"Cannot find server") > 0 or
instr(1,titleStr,"HTTP 404") > 0 Then
        msg = msg & "==> broken link" & vbNewLine
        Reporter.ReportEvent micFail, "Link " & linkText, msg
    else
        msg = msg & "==> good link" & vbNewLine
        Reporter.ReportEvent micPass, "Link " & linkText, msg
    End If

    ' Navigate back to links page.
    BrowserObj.Back
    BrowserObj.Sync

    ' Rebuild link collection, navigating away and back
destroys previous collection.
    Set oLinkCollection = BrowserPageObj.ChildObjects(oDesc)
Next

' Release the objects
Set oLinkCollection = nothing
Set BrowserObj = nothing
Set BrowserPageObj = nothing
Set oDesc = nothing
 
Is This Answer Correct ?    1 Yes 0 No
Rnashok
 
  Re: Give me some scripts for 1). checking webpage links (counting links,opening web pages,counting child elements)
Answer
# 2
Hi Rnashok,

I used similar function in my script.But getting syntax 
error when I try to run the script.Let me know how to solve 
it.Herez my function.....

Function eTimeSummary(hours)

   rowCount = Browser("XYZ").Page("XYZ_8").WebTable
("Employee #").RowCount

   cellData = Browser("XYZ").Page("XYZ_8").WebTable
("Employee #").GetCellData(1,1)
   
    If cellData <> "Commission Information is not available 
for this time period" Then

	   For i = 2 to 2'rowCount
	   hoursTotal = Browser("XYZ").Page
("XYZ_8").WebTable("Employee #").GetCellData(rowCount, 6)
	   
	    If  Trim(hours)= Trim(hoursTotal) Then
			Reporter.ReportEvent 0, "Verifying 
AssociateSummaryForODhours  and eTimeSummaryhours 
Total", "Summary Total Passed."
			'msgbox "testpassed"
		Else
			Reporter.ReportEvent 1, "Verifying 
AssociateSummaryForODhours  and eTimeSummaryhours 
Total", "Summary Total Failed."
		End If
   Next

   End If
  
   Browser("XYZ").Back
   Browser("XYZ").Page("XYZ_4").Sync
End Function
 
Is This Answer Correct ?    0 Yes 0 No
Lkiran
 
 
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
how to write scripts in QTP? Ordain-Solutions3
how we can know qtp has used smart identification machanism during the execution. IBM2
What is a Run Time Data table?  1
how to write the descriptive programming in QTP for loginwindow.without using Step generator,object repository for referecnes STC3
what is the use of descripting programming? Ordain-Solutions4
regular expression Wipro2
suppose i have one datatable in my datatable in 2 nd row 3rd column one link is ther i need to validate that link how do u do this?(wipro) Wipro2
There is one login screen,after accepting valid username and apassword, it will show the next screen. In the 2nd screen u r having 2 combo boxes, U have to select any item from these, and click OK button. After closing that, it will show the 3rd screen. If u click CANCEL button from 2nd screen it will show the first screen. Write QTP script for it??? Sonata1
Why VB scripts are used in QTP and TSL in Winrunner, is there any advantage of using VB Scripts  2
What are the types of Object Repositories in QTP?  4
I am not able to record yahoomail browser.its giving error like "The browser Application can't be launched .Posssibly the URL is wrong" So anyone can tell me what setting i have to do in qtp??  1
How can you find Local Host Name by Using QTP?  4
i have to pass the testcases into userid anf password of gmail login page using functions you can take your own testcaseslike userdid should take only lowerletters it should not take special charactors and uppercase letters and password should take only numericvalues it should not take alphanumeric and alphabets  2
wt is the xtension of the QTP result view file?  4
what is the main use of reviews Ordain-Solutions1
DIFFERENT RUN MODE IN QTP..1-VERIFY MODE 2-UPDATE MODE 3- dEBUG MODE. My question is in whic sitution we use these modes Explain me with example  1
While recording a login window QTP is identifying only parent window,then how can u identify the child objects. Symphony2
In QTP for .net application which plug in is used? For Java Application which plug in is used ? AppLabs2
How to map the test cases to requirements in QC? IBM2
Where u will use output checkpoint in QTP?  3
 
For more QTP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com