Sunday, February 7, 2010

Invoke the Browser using QTP , Load the URL, Close the browser and Delete the cookies

systemUtil.Run "Iexplore.exe","www.naukri.com"
'Check wether Qtp Invoked the application or not
qa= Browser( "Cannot find server").GetROProperty("OpenedByTestingTool")
'find the HWND ID
qa1= Browser( "Cannot find server").GetROProperty("hwnd")
'Find the Name of the browser
qa2= Browser( "Cannot find server").GetROProperty("name")
'Find title of the Browser
qa3= Browser( "Cannot find server").GetROProperty("title")
'Close the browser
Browser("Cannot find server").close
SystemUtil.CloseDescendentProcesses
SystemUtil.CloseProcessByHwnd qa1
SystemUtil.CloseProcessByName "qa2"
SystemUtil.CloseProcessByWndTitle "qa3"


'Chk the Address Bar, true or flase
Msgbox Browser("Cannot find server").Object.AddressBar
'Application Name
Msgbox Browser("Cannot find server").Object.Application
'check Browser is busy
Msgbox Browser("Cannot find server").Object.Busy
'Check is a Object or not
Msgbox Browser("Cannot find server").Object.Document
'Name of the Browser and Path
Msgbox Browser("Cannot find server").Object.FullName
'Browser is Full scrreen or Not
Msgbox Browser("Cannot find server").Object.FullScreen
'Height of the Browser
Msgbox Browser("Cannot find server").Object.Height
'Find the HWND ID
Msgbox Browser("Cannot find server").Object.HWND
'Chk the Left
Msgbox Browser("Cannot find server").Object.Left
'Application name
Msgbox Browser("Cannot find server").Object.LocationName
'check Memu Bar is visiable
Msgbox Browser("Cannot find server").Object.MenuBar
'Name of the application
Msgbox Browser("Cannot find server").Object.Name
'check application is Off mode
Msgbox Browser("Cannot find server").Object.Offline
'check the Parent of the application
Msgbox Browser("Cannot find server").Object.Parent
'Path of the application
Msgbox Browser("Cannot find server").Object.Path
'Wether apps is Ready state
Msgbox Browser("Cannot find server").Object.ReadyState
'chk the size of the apps
Msgbox Browser("Cannot find server").Object.Resizable
'chk Object doing any action
Msgbox Browser("Cannot find server").Object.Silent
'check the status Bar
Msgbox Browser("Cannot find server").Object.StatusBar
'display the Status bar Text
Msgbox Browser("Cannot find server").Object.StatusText
'Chk the Full Screen Mode
Msgbox Browser("Cannot find server").Object.TheaterMode
'chk the Tool Bar
Msgbox Browser("Cannot find server").Object.ToolBar
'Type of the Application
Msgbox Browser("Cannot find server").Object.Type
'check the Visiblity of the Browser
Msgbox Browser("Cannot find server").Object.Visible
'Width of the Browser
Msgbox Browser("Cannot find server").Object.Width
'Close the browser
Browser("Cannot find server").close
SystemUtil.CloseDescendentProcesses
SystemUtil.CloseProcessByHwnd qa1
SystemUtil.CloseProcessByName "qa2"
SystemUtil.CloseProcessByWndTitle "qa3"

Built-in Environment Variable for QTP

MyVar = environment("ActionIteration")
Msgbox MyVar
MyVar = environment("ActionName")
Msgbox MyVar
'MyVar = environment("ControllerHostName")
'Msgbox MyVar
'MyVar = environment("LocalhostName")
'Msgbox MyVar
MyVar = environment("OS")
Msgbox MyVar
'MyVar = environment("OsVersion")
'Msgbox MyVar
MyVar = environment("ProductDir")
Msgbox MyVar
MyVar = environment("ProductName")
Msgbox MyVar
MyVar = environment("ProductVer")
Msgbox MyVar
MyVar = environment("ResulrDir")
Msgbox MyVar
'MyVar = environment("Scenairold")
'Msgbox MyVar
MyVar = environment("SystemTempDir")
Msgbox MyVar
MyVar = environment("TestDir")
Msgbox MyVar
MyVar = environment("TestIteration")
Msgbox MyVar
MyVar = environment("TestName")
Msgbox MyVar
MyVar = environment("UserName")
Msgbox MyVar
'MyVar = environment("UpdatingAcvtiveScreen")
'Msgbox MyVar
'MyVar = environment("UpdatingtoDescriptions")
'Msgbox MyVar
'MyVar = Environment("Vuserid")
'Msgbox MyVar