HOW TO COUNT NUMBER OF ITEMS PRESENT IN WEB LIST

Answer Posted / raju

to get an HTML source code of Web page
HtmlCode = Browser("Google Labs").Page("Google Labs").Object.documentElement.outerHtml

' save HTML code to a local file
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile("C:\HtmlCode.html", True, -1)
f.Write(HtmlCode)
f.Close()

' run tidy.exe to convert HTML to XHTML
Set oShell = CreateObject("Wscript.shell")
oShell.Run "C:\tidy.exe --doctype omit -asxhtml -m -n C:\HtmlCode.html", 1, True ' waits for tidy.exe to be finished

' create MSXML parser
Set objXML = CreateObject("MSXML2.DOMDocument.3.0")
objXML.Async = False
objXML.Load("C:\HtmlCode.html")

XPath = "//a" ' XPath query means to find all links
Set Links = objXML.SelectNodes(XPath)
Msgbox "Total links: " & Links.Length

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is regular expression?

569


How do you delete unwanted results in qtp?

595


what is the difference between modular framework & datadriven framework

1587


how can we compare descriptive programing with a regular expression

1910


Difference between test object and run time object?

582






Define object spy ?

554


Explain the benefits of quick test pro(qtp)?

561


Hi I'm a beginner in QTP. So far I'm ok with Descriptive but stuck while implementing Hybrid Frame work. 1. I have created a Keyword file with .vbs ext set home=description.create home("title").value="Welcome to feests" set reglink=description.create reglink("name").value="register yourrestaurant / take away" set fbusname=description.create fbusname("name").value="business_name" set dispname=description.create dispname("name").value="display_name" set restchkbox=description.create restchkbox("name").value="restaurant" set cuiscate=description.create cuiscate("name").value="cuisine_categery1" set addline1=description.create addline1("name").value="address_line1" set pstcode=description.create pstcode("name").value="address_postcode" set cntry=description.create cntry("name").value="address_country" set mlandno=description.create mlandno("name").value="landline_no" set emailadd=description.create emailadd("name").value="email" 2. I have created an Function Library file as follows Function launch() bro="C:\Program Files\Internet Explorer\iexplore.exe" url="http://www.feests.com/" invokeapplication bro&" "&url Browser(home).page(home).Link(reglink).click End Function Function restregistration(karthik, teja, Ameerpet, UK) Browser(home).page(home).WebEdit(fbusname).set "karthik" Browser(home).page(home).WebEdit(dispname).set "teja" Browser(home).page(home).WebCheckBox(restchkbox).set "ON" Browser(home).page(home).WebList(cuiscate).Select "Indian" Browser(home).page(home).WebEdit(addline1).set "Ameerpet" Browser(home).page(home).WebEdit(pstcode).set "UK" Browser(home).page(home).WebList(cntry).select "United Kingdom" Browser(home).page(home).WebEdit(mlandno).set "023775347" Browser(home).page(home).WebEdit(emailadd).set "email@gmail.com" End Function 3. This is how I have called the keywords and Functions in QTP executefile"C:\Documents and Settings\karthik\Desktop\keywords.vbs" executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs" launch restregistration karthik, teja, Ameerpet, UK, "email@gmail.com" Now the issue is, I'm trying to enter the email ID in WebEdit field. But I dont know what is the mistake I did, if I run the script in QTP it is showing following error Error: Expected identifier Line (2): "executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs"". Can someone help me fix this, please!!?

4962


What is the difference between local and shared object repository in qtp?

547


Hi there, I've installed a trial version of QTP to see if it works with my product but I cant automate selecting windows from a tree view? Can anyone give me any pointers? Many Thanks

1407


How to carry out bit map check points in QTP

1753


Hi Sudhananda, plz send me the QTP framework with any diagram and PPTS . I want to switch to automatio, I done QTP from professional person, but he does not give me his knowledge properly. so pls help me Thaks send me on following address mirajkar.akash@gmail.com

1860


To which environments does quicktest professional (qtp) supports?

579


What is a data driven test in qtp?

569


What is the meaning Work bench?

1753