DOM and AOM Scripts

'Display all the Elements Tags and Text in the objects in Webpage
Set d=Browser("Google").Page("Google").Object
For Each e In d.all        
  TagName= e.TagName
   InnerText = e.innerText
   print TagName&"    "&InnerText
Next

'Open Gmail and set the text in the Edit Box
systemutil.Run "www.google.com"
Set obj= Browser("name:=Google").Page("name:=Google").Object.getElementsByTagName("INPUT")
n=obj.Length-1
For i=0 to n
   If obj(i).Name="q" and obj(i).Type="text" Then
     Browser("name:=Google").Page("name:=Google").Object.getElementsByTagName("INPUT")(i).Value="Venkatgn"
  End If
Next

' Open the Script in QTP from QC and Run, Close the Test, QTP
Set app=CreateObject("QuickTest.Application")
app.Launch
app.Visible = True
Set qtpres=CreateObject("QuickTest.RunResultsOptions")
app.Open "[QualityCenter] Subject\Requirements\Login\tst_login", True
qtpres.ResultsLocation = "d:\qtpresults"
app.Test.Run
app.Test.Close
app.quit
set qtpres = Nothing
Set app = Nothing

Comments