Posts

Showing posts from January, 2017

Create a Main Folder,SubFolder in UFT and ZipAttachment to QC test

Function CreateMainFolder() On Error Resume Next 'Dim strDrive, strfoldername,objFSO, objFolder strDrive = "K:\QA\" strfoldername="Automation_Results" strPath= strDrive&strfoldername Set FSO = CreateObject("Scripting.FileSystemObject") Check = FSO.FolderExists(strPath) Set FSO = Nothing If Not Check Then Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.CreateFolder(strPath) End If End Function Function CreateSubFolder(strPath) On Error Resume Next 'Dim  strSubFile,objFSO, objFolder ''strSubFile = "Production_Result_"& Day(now) & "_" & month(now) & "_" & year(now) & "_"& hour(now) & "_" & minute(now) ''strNewpath=strPath& "\"&strSubFile Set FSO = CreateObject("Scripting.FileSystemObject") Check = FSO.FolderExists(strNewpath) Set FSO = Nothi

Customized HTML reports in UFT

Public strHTMLFileName,strFileURL,htmlresult,fso @@@@@@@@@@@@@@@@@ Function OpenFile() On error resume next strHTMLFileName= gbReportFilePath & "\TestResult_" & Day(now) & "_" & month(now) & "_" & year(now) & "_" & hour(now) & "_" & minute(now) &".html" StartTime = Timer stTime = Time Set fso = CreateObject("Scripting.FileSystemObject") Set htmlresult = fso.CreateTextFile(strHTMLFileName, ForWriting, True) 'OpenTextFile(strHTMLFileName, ForWriting, True) strFileURL = strHTMLFileName  CreateHeader End Function @@@@@@@@@@@@ 'Create header in reporter file Function CreateHeader() On error resume next htmlresult.writeline("<html>") htmlresult.writeline("<title>"&Environment("TestName")&"</title>") htmlresult.WriteLine("<head></head>") htmlresult.WriteLine("

UFT Run time added Data table

Function Importsheets() uploadfile = "check.xls" 'fname = "K:\QA\check.xls" Datasheet = "Search" 'ADDING THE SHEETS TO DATATABLE (YOU CAN GIVE YOUR OWN NAME TO SHEETS) DataTable.AddSheet sheet1 Datatable.DeleteSheet "Action1" DataTable.DeleteSheet "Global" wait 5 'IMPORTING THE SHEETS TO DATATABLE DataTable.ImportSheet fname,sheet1,Datasheet End Function

UFT Delete cookies for IE

'Create the WebUtil object to delete cookies Dim WshShell,objShell Function Deletecookies() Set WshShell = CreateObject("WScript.Shell") WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8" 'To clear browsing cookies WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2" 'To Clear Browsing History WshShell.run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1" Wait 10 End Function