Automation Testing, Manual Testing, QTP/UFT 11 , QC/ALM 11 ,SAP TAO, Unix, Selenium, Oracle SQL, Shell Scripting and For Online Trinings to contact me : Cell:+91-8897972059 , Email Id : quicktestprotech@gmail.com

Saturday, January 29, 2011

Web Scripts

Web Scripts

1) Count all opened Browsers on desktop, Capture Browser names and
export to an Excel file

Dim oBrowser, Browsers, TotBrowsers, i,r
Set objExcel=CreateObject("Excel.
Application")
Set myFile=objExcel.Workbooks.Open ("C:\Documents and
Settings\Administrator\Desktop\qtclass.xls")
Set mySheet=myFile.Worksheets("Sheet3")
r=1
mysheet.Cells(r,"C")="Browser Names"
Set oBrowser=Description.Create
oBrowser("micclass").value="Browser"

Set Browsers=Desktop.ChildObjects(oBrowser)
TotBrowsers=Browsers.Count
Msgbox TotBrowsers

For i= 0 to TotBrowsers-1 Step 1
       r=r+1
myBrowser=Browsers(i).GetRoproperty("title")
mysheet.Cells(r,"C")=myBrowser
Browsers(i).Close
Next

myFile.Save
objExcel.Quit
Set objExcel=Nothing

0 comments:

Post a Comment

Loading...