Monday, April 27, 2015

Set fso = CreateObjcect(“Scripting.FilesystemObject”)



Set  fso = CreateObjcect(“Scripting.FilesystemObject”)
 
File operations:
Set File = fso.createtextfile(“path”,true)
Set file = fso.opentextfile(“path”,1/2/8(read/write/append))
 
‘Writing into the file
File.write “text”
File.writeline “text”
 
‘Reading from the file
Do while file.AtendofStream <> true
File.readall
File.readline
Loop
Do while file.atendofline<> true
File.read(2) 
Loop
File.close
Set file = nothing
Set fso = nothing
 
Method: GetFile
Set fso=createobject("Scripting.FileSystemObject")
 
'File for  getting details  Sourcefile="D:\qtptest.txt"
 Set get_file=fso.GetFile(Sourcefile) 
 
'Some of  the following details can be retrieved from a file
msgbox  get_file.DateCreated
msgbox  get_file.DateLastAccessed
msgbox  get_file.DateLastModified
msgbox  get_file.ParentFolder
msgbox  get_file.Path
 
Set fso=nothing      
Fso.copyfile(sourcefilepath,destfilepath)
Fso.fileexist(filepath)àtrue/false
Fso.deletefile(path)
 
Folder operations:
 
Fso.folderExist(folderpath)
Set fol = Fso.getfolder(folderpath)
Set subfol = fol.subfolders
Fso.deletefolder(path)
Fso.createfolder(path)
Fso.copyfolder(source,dest)
Fso.movefolder(source,destination) //all are paths with folder
 
 
 
Drivers operations:
 
Fso.drivers
For each dr in fso.drivers
                    Dr.driverletter
next
 
fso.getdriver(“D:/”)
 
msgbox  get_drv.AvailableSpace
Msgbox  get_drv.DriveLetter
msgbox  get_drv.DriveType
msgbox  get_drv.FileSystem
msgbox  get_drv.FreeSpace
msgbox  get_drv.Path
Msgbox  get_drv.RootFolder
Msgbox  get_drv.SerialNumber
Msgbox  get_drv.TotalSize
 
Fso.driverexist(“D:/”)
 

Thursday, January 30, 2014

How to handle Dialog box in Mozilla

If Browser("Browser").DialogExists Then    ----> to check whether dialog exist in Mozilla
    Browser("Browser").GetDialogText -----> to  get the text from Mozilla
    Browser("Browser").HandleDialog micOK    --->To click the ok button
    Browser("Browser").HandleDialog micCancel   -----> to click the cancel button
End If

Monday, December 23, 2013

How to Handle “Dialogs” in Firefox (using QTP) --Method2

Browser("Browser").HandleDialog micOK
browserText = Browser("Browser").GetDialogText

How to Handle “Dialogs” in Firefox (using QTP)

Sometimes QTP doesn’t recognize a dialog in Firefox. These types of Dialogs are not caught by the Object Spy and it seems difficult to handle it if its appearing somewhere in your application. Following code helped me get out of this situation :-
dialogText=Browser(“creation time:=0″).GetDialogText
If Instr(dialogText,”Text that you are looking for”) Then
Browser(“creation time:=0″).HandleDialog micOK
Else
Print “Unknown Dialog Found”
End If
The above code will click on the OK button if the “Text that you are looking for” (this can be any user defined value) matches the Text that is displayed on the Dialog.

How to Handle “Dialogs” in Firefox (using QTP)

Sometimes QTP doesn’t recognize a dialog in Firefox. These types of Dialogs are not caught by the Object Spy and it seems difficult to handle it if its appearing somewhere in your application. Following code helped me get out of this situation :-
dialogText=Browser(“creation time:=0″).GetDialogText
If Instr(dialogText,”Text that you are looking for”) Then
Browser(“creation time:=0″).HandleDialog micOK
Else
Print “Unknown Dialog Found”
End If
The above code will click on the OK button if the “Text that you are looking for” (this can be any user defined value) matches the Text that is displayed on the Dialog.

Monday, November 11, 2013

How to run QTP script even when the system is locked

In "HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\SkipEnvironmentChecks" registry change the value to1, then system will runs the QTP scripts even when the system is locked.