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                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
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 ?    0 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 connect to data base?  1
1)what is the Exact Meaning of Environment Variables? 2)what is Compile Module in QTP? what exactly it contains Functions or Actions?  3
how can i call reusable action in a function could any one explain me? Livetek2
What is the difference between Functions and Action ?  1
we have a link in a website or webtable How can we record link in that table or site? link is not static we don't know exact location of that link? how ? if u know pls give reply with script also? Covansys3
WHAT IS SMATR IDENTIFICATION? plz EXPLAIN BRIEFLY? IS IT POSSIBLE in QTP? HOW AND WHEn THE SITUATION U R USING EXPLAIN WITH EXAMPLE?  3
what is the extension for QTP files? AppLabs5
Pls explain me the difference between ........ Description.Create and CreateObject  1
Consider a scenario where there are two action sheets say action 1 and action 2. Can Action 1 take values from action 2 data sheet or vice versa. If so, how? Oracle5
i this is balaji from chennai i have 4 yrs exp in testing and my qualification is bsc computers i completed in correspondace in which companiies accept the correspondace plz let me know  1
There is a name "AJAY" how do u count no.of. "A" in that name ?  2
what is keyword driven framework in qtp. TCS4
Explain the concept of how QTP identifies object. Ordain-Solutions2
What is the QTP test frame work? IBM1
what we do after completion of functional and regression testing  2
how do u retrieve data from a database ? i.e. i want to retrieve 2nd record only from a database ? write code for this. by using ADODB connecton, RSOBJ and using a FOR loop we can retrieve all the records( ex: if we give query as select * from emp). but i want only 2nd record. so how to acheive this. Accenture1
can we run the scripts of QTP8.2 in QTP7.0?  1
hello, i was install Q.T.P.8.2 in windows xp version .when i am running my programs all the desktop icons are disappear why so. please guide me anybody how can i come out side this problem.  2
Could anyone please tell me one situation where you have used recovery scenarion in real time with an example?  3
How do you change Logical Name of the object in test script? TCS1
 
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