Good library for automation
Command Set
Public LOG_LEVEL, REPORT_TYPE
LOG_LEVEL = 4
REPORT_TYPE = 6
'########################################################################################################################################################################
'#Function Description: Click on the specific link for the object button
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("View/change payments").Link("Confirm")
'# Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebButton("Confirm"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Object_Click(Obj)
Object_Text = Obj.ToString
Select Case True
Case Not Obj.Exist
ReportStepResult Test_Step_Id, "Failed", Object_Text & " does not exist on current page"
Object_Click = False
Case Obj.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is not visible"
Object_Click = False
Case Obj.GetROProperty("micclass") = "WinButton"
If Obj.GetROProperty("enabled") = False Then
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_Click = False
Else
Obj.Click
Object_Click=True
End If
Case Obj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_DoubleClick = False
Case Else
Obj.Click
Object_Click=True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Double-Click on the specific link for the object
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("View/change payments").Link("Confirm")
'# Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebButton("Confirm"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Object_DoubleClick(Obj)
Object_Text = Obj.ToString
Select Case True
Case Not Obj.Exist
ReportStepResult Test_Step_Id, "Failed", Object_Text & " does not exist on current page"
Object_DoubleClick = False
Case Obj.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is not visible"
Object_DoubleClick = False
Case Obj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_DoubleClick = False
Case Else
Obj.Click
Obj.FireEvent "ondblclick"
Object_DoubleClick = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Verify the combo exists and check it the item is available on combo and select the item
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Combo_Select(ObjCombo,Exp_Item)
Combo_Text = ObjCombo.ToString
Select Case True
Case Not ObjCombo.Exist
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " does not exist on current page"
Combo_Select = False
Case ObjCombo.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " is not visible"
Combo_Select = False
Case ObjCombbject.isDisabled
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " is disabled"
Combo_Select = False
Case ObjCombo.GetROProperty("items count") = 0
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " does not have any items to select"
Combo_Select = False
Case Else
For i=1 to ObjCombo.GetROProperty("items count")
Item_ = ObjCombo.GetItem(i)
If Instr(1, Trim(Item_), Trim(Exp_Item), 1) > 0 Then
ObjCombo.Select Item_
Combo_Select = True
Exit For
End If
Next
End Select
If Combo_Select <> True Then
ReportStepResult Test_Step_Id, "Failed", "Unable to select " & Exp_Item & " from " & Combo_Text
Combo_Select = False
End If
End Function
'########################################################################################################################################################################
'#Function Description: The function sets the given radio button object
'#Input Parameters:Radio button object (e.g. Set Obj = Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebRadioGroup("PaymentTransferType"))
'#Return Values: True/Error Message
'#######################################################################################################################################################################
Public Function Set_Radio_Group_Button(BtnObj,GrpId)
If Left(GrpId, 1) = "#" Then
GrpId = Right(GrpId, Len(GrpId) -1)
End If
Select Case True
Case Not BtnObj.Exist
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " doesn't exist"
Set_Radio_Group_Button=False
Case BtnObj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " is disabled"
Set_Radio_Group_Button=False
Case BtnObj.GetROProperty("visible") <> True
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " is not visible"
Set_Radio_Group_Button=False
Case Else
BtnObj.Select "#" & GrpId
Set_Radio_Group_Button = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Verify the combo exists and select based on Item no
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"),"#3")
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Combo_Select_Item(ObjCombo,Exp_Item_No)
Combo_Text = ObjCombo.ToString
If ObjCombo.Exist Then
Prty = ObjCombo.GetROProperty("visible")
If Prty =True Then
If instr(Exp_Item_No,"#") > 0 Then
Item_No = Cint(Replace(Exp_Item_No,"#",""))
Else
Item_No = Cint(Exp_Item_No)
End If
Item_ = ObjCombo.GetItem(Item_No + 1)
ObjCombo.Select Item_
Combo_Select_Item = True
Else
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " combo box is not visible"
Combo_Select_Item = False
End If
Else
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " combo box does not exist on current page"
Combo_Select_Item = False
End If
End Function
'########################################################################################################################################################################
'#Function Description: Verify the List exists and return the active status
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"))
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function List_Verify(ObjList,Exp_Item)
'
' Listbox_Text = ObjList.ToString
' If ObjList.Exist Then
' Prty=ObjList.GetROProperty("visible")
' If Prty =True Then
' Item_count = ObjList.GetRoProperty("items count")
' If Item_count > 0 Then
' For i=1 to Item_count
' Item_ = ObjList.GetItem(i)
' If UCase(Trim(Item_)) = UCase(Trim(Exp_Item)) Then
' List_Verify=True
' Exit For
' End If
' Next
' If List_Verify <> True Then
' ReportStepResult Test_Step_Id, "Failed", Exp_Item & " does not exist in " & Listbox_Text
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box does not have any items to select"
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box is not visible"
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box does not exist on current screen"
' List_Verify = False
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is used to Set the text in edit box
'#Input Parameters:: Object and value to be Set in (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebEdit("recipientName"),1234)
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Edit_Set(ObjEdit, Value_)
Edit_Text = ObjEdit.ToString
Select Case True
Case Not ObjEdit.Exist
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " does not exist on current screen"
Edit_Set = False
Case ObjEdit.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " is not visible"
Edit_Set = False
Case Not ObjEdit.Object.isContentEditable
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " is disabled and cannot be changed"
Edit_Set = False
Case Else
ObjEdit.Set Value_
Edit_Set = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: The function is used to Type in a text in edit box
'#Input Parameters:: Object and value to be typed in
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Edit_Type(ObjEdit, Value_)
'
' Edit_Text = ObjEdit.ToString
' If ObjEdit.Exist Then
' Prpty = ObjEdit.GetROProperty("visible")
' If Prpty =True Then
' ObjEdit.Type Value_
' Edit_Type= True
' Else
' ReportStepResult Test_Step_Id, "Failed", Edit_Text & " edit box is not visible"
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Edit_Text & " edit box does not exist on current screen"
' End If
'
' End Function
'########################################################################################################################################################################
'#Function Description: The function is select the specific tab on the application any object
'#Input Parameters:: Object
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Obj_Tab(Obj)
'
' If Obj.Exist Then
' Prpty = Obj.GetROProperty("visible")
' If Prpty =True Then
' ObjEdit.Type micTab
' Obj_Tab = True
' Else
' ReportStepResult Test_Step_Id, "Failed", Obj & " is not visible"
' Obj_Tab = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Obj & " does not exist on current screen"
' Obj_Tab = False
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies is the given check box object is checked or not
'#Input Parameters:Check Box Object
'
'
' Amend to cater for Prpty = ObjChkbox.GetROProperty("checked") == ON/1 or OFF/0
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function Checkbox_IsChecked(ObjChkbox, ExpStatus)
'
' Chkbox = ObjChkbox.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' Const GWL_STYLE=-16
' If ObjChkbox.Exist(2) Then 'Verify is the button exists
' Prpty = ObjChkbox.GetROProperty("visible") 'Capture visible property of the object
' If Prpty =True Then
' Checkbox_IsChecked = Chkbox&" is visible"
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Prpty = ObjChkbox.GetROProperty("checked")
' Select Case ExpStatus
' Case "YES","Y","ON"
' If (Prpty="ON") OR (Prpty = 1) Then
' Checkbox_IsChecked = True
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", "CheckBox is checked","VERIFICATION"
' Else
' Checkbox_IsChecked = Chkbox&" is not checked and IS expected to be"
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Case "NO","N","OFF"
' If (Prpty="OFF") OR (Prpty = 0) Then
' Checkbox_IsChecked = True
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", "CheckBox is not checked", "VERIFICATION"
' Else
' Checkbox_IsChecked = Chkbox&" is checked and IS NOT expected to be."
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Case Else
' Checkbox_IsChecked = "Status not coded for: " & ExpStatus
' End Select
' Else
' Checkbox_IsChecked =Chkbox&" is not Visible"
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to set value to an Edit box
'#Input Parameters:: Edit box Object, value to be verified
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function Edit_Verify(ObjEdit, Value_)
'
' Edit_Text = ObjEdit.ToString 'Capture Name of the Test Object
' If ObjEdit.Exist Then 'Verify is the Edit box is exists
' Gen_Report_Event micPass,Edit_Text&" found Successfully ", "","VERIFICATION"
' Act_Value = ObjEdit.GetROProperty("text") 'Capture value from edit box
' If IsDate(Value_) Then
' If Act_Value = "" Then
' Act_Value = 0
' End If
' If CDate(Act_Value)=CDate(Value_) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' ElseIf IsNumeric(Value_) Then
' If Act_Value = "" Then
' Act_Value = 0
' End If
' If Round(Replace(Act_Value,",",""),2) = Round(Replace(Value_,",",""),2) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' Else
' If UCase(Trim(Replace(Act_Value,",","")))=UCase(Trim(Replace(Value_,",",""))) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' End If
' Else
' Edit_Verify = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function captures the snapshot of the desktop by using windows API calls
'#Input Parameters:None
'#Return Values: None
'#######################################################################################################################################################################
'Public Function AltPrintScreen()
'
' Const KEYEVENTF_KEYUP = "&H2"
' Const VK_SNAPSHOT= "&H2C"
' Const VK_MENU = "&H12"
' extern.Declare micVoid,"keybd_event","user32","keybd_event", micByte, micByte, micLong, micLong
' extern.Declare micHwnd ,"GetClipboardData","user32","GetClipboardData", micUInteger
' Extern.keybd_event VK_MENU, 0, 0, 0
' Extern.keybd_event VK_SNAPSHOT, 0, 0, 0
' Extern.keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
' Extern.keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function captures the snap shots of the error/warning message popped up during the execution and saves them in a predefined location
'#Input Parameters:Error Message to be written into the word file
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Capture_Snap_Shot(Err_Msg)
'
' Call Check_Snapshot_File() 'Verify whether the snapshot file is available or not.
' Set objWD = CreateObject("Word.Application") 'Create word document
' Set wrdDoc = objWD.Documents.Open(snap_shots_file)
' Set trange = wrdDoc.Content
' trange.Paragraphs.Add 'Create Paragraphs
' pc = wrdDoc.Paragraphs.Count
' StartRange = wrdDoc.Paragraphs(pc).Range.Start
' EndRange = wrdDoc.Paragraphs(pc).Range.End
' trange.SetRange StartRange,EndRange
' trange.Text="Test Name: "&Environment("TestName")&" Action Name: "&Environment("ActionName")&Chr(13)&Err_Msg&Chr(13)
' trange.Paragraphs.Add
' pc = wrdDoc.Paragraphs.Count
' StartRange = wrdDoc.Paragraphs(pc).Range.Start
' EndRange = wrdDoc.Paragraphs(pc).Range.End
' trange.SetRange StartRange,EndRange
' Call AltPrintScreen() 'Capture snap shot
' tRange.Paste 'Save the snap shot captured in a word file
' objWD.ActiveDocument.Save
' objWD.Quit
' Set objWD = Nothing
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function deletes files at the given folder
'#Input Parametersictionary object with absolute path of folder location
'#Return Values: True/Error Message based on execution status
'#######################################################################################################################################################################
'Public Function Delete_All_files(fldr)
'
' Dim fso
' Set fso = CreateObject("Scripting.filesystemobject") 'Create file system object
' If fso.folderExists(fldr) Then 'Verify is the folder exists
' Set oFolder = fso.GetFolder(fldr)
' For Each oFile In oFolder.Files 'Access file by file
' oFile.Delete True 'setting force to true to delete readonly files
' Next
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: Check if the file exists on specified path
'#Input Parameters: Path +File name string
'#Return Values: True/Error Message
'#######################################################################################################################################################################
'Public Function File_Exists(pathName)
'
' Dim objFSO
' Set objFSO = CreateObject("Scripting.FileSystemObject")
' File_Exists = objFSO.FileExists(pathName) ' check for file
' Set objFSO=nothing
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function fetches data from database and saves the record set into a given xml file
'#Input Parametersictionary object database server name, database name, db username, db password, query to be executed and full path of file where recordset need to be stored
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Save_RecordSet(Srvr,Uid,Pwd,Query,Exp_Loc)
'
' Set objCONN = CreateObject("ADODB.Connection") 'Create connection object
' Set objRS=CreateObject("ADODB.RecordSet") 'Create Record set object
' objCONN.CommandTimeout=1000 'Set command timeoutr limit
' '{Oracle in instantclient11_1};dbq=TWPSIT; Uid=TEST_RW_USER; Pwd=w1ckham!1
' objCONN.ConnectionString="DRIVER={Oracle in instantclient11_1};dbq="&Srvr&";UID="&Uid&";PWD="&Pwd 'Establish a Database connection
' objCONN.Open 'Open db connection
' If objCONN.State = 1 Then 'verify db connection status
' Gen_Report_Event micPass,"Verify Database Connection ", "Database connection has been established successfully","VERIFICATION"
' Gen_Report_Event micDone,"Execute Query", Query,"ACTION"
' objRS.open Query,objCONN 'Execute the given query
' If objFso.FileExists(Exp_Loc) Then 'Delete the existing recordset extract
' Set f = objFso.GetFile(Exp_Loc)
' f.Delete
' End If
' objRS.Save Exp_Loc,1 'Save Record set
' If objRS.State = 1 Then
' objRS.Close 'Close Database connection
' End If
' objCONN.Close 'Close connection
' Status=True
' Else
' Status="Failed to establish Database connection "
' End If
' Save_RecordSet =Status
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function executes a given query on against a specified database
'#Input Parametersictionary object database server name, database name, db username, db password and query to be executed
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Execute_DB_Query(Srvr,Uid,Pwd,Query)
'
' Set objCONN = CreateObject("ADODB.Connection") 'Create connection object
' Set objRS=CreateObject("ADODB.RecordSet") 'Create Record set object
' objCONN.CommandTimeout=1000 'Set command timeoutr limit
' objCONN.ConnectionString="DRIVER={Oracle in instantclient11_1};dbq="&Srvr&";UID="&Uid&";PWD="&Pwd 'Establish a Database connection
' objCONN.Open 'Open db connection
' If objCONN.State = 1 Then 'verify db connection status
' objRS.open Query,objCONN 'Execute the given query
' If objRS.State = 1 Then
' objRS.Close 'Close Database connection
' End If
' objCONN.Close 'Close connection
' Status=True
' Else
' Status="Failed to establish Database connection "
' End If
' Execute_DB_Query=Status
'
'End Function
'########################################################################################################################################################################
'#Function Description: Function to retrieve clipboard data
'#Input Parameters:None
'#Return Values: Clipboard data
'#######################################################################################################################################################################
'Public function Get_Clipboard_Data()
'
' Set objHTML = CreateObject("htmlfile")
' Get_Clipboard_Data = objHTML.ParentWindow.ClipboardData.GetData("text")
' Set objHTML = nothing
'
'End function
'########################################################################################################################################################################
'#Function Description: The function halts the execution until the maximum time specified or the given object is invoked, whichever occurs first
'#Input Parameters:: Object and maximum timelimit
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Wait_Until_Load(Obj,max_time)
'
' blndone=False
' counter=0
' Do While not(blndone)
' If Obj.Exist(0) Then 'Poll for every 2 secs, to verify the existance of the object
' blndone=True
' Exit Do
' Else
' If (counter > max_time) Then
' Exit Do
' Else
' wait(1)
' counter=counter+2
' End If
' End If
' Loop
' Wait_Until_Load=blndone
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Edit box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function Edit_Get(ObjEdit)
'
' Edit_Text = ObjEdit.ToString 'Capture Name of the Test Object
' If ObjEdit.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjEdit.GetROProperty("text") 'Capture value from edit box
' Edit_Get = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get text from "&Edit_Text, Edit_Get,"ACTION"
' Edit_Get = Act_Value
' Else
' Edit_Get = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, Edit_Get,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Web Element box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function WebElement_Get(ObjElement)
'
' Edit_Text = ObjElement.ToString 'Capture Name of the Test Object
' If ObjElement.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjElement.GetROProperty("innertext") 'Capture value from edit box
' WebElement_Get = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get innertext from "&Edit_Text, WebElement_Get,"ACTION"
' WebElement_Get = Act_Value
' Else
' WebElement_Get = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, WebElement_Get,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Web Element box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function WebElement_GetValue(ObjElement)
'
' Edit_Text = ObjElement.ToString 'Capture Name of the Test Object
' If ObjElement.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjElement.GetROProperty("value") 'Capture value from edit box
' WebElement_GetValue = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get 'value' from "&Edit_Text, WebElement_GetValue,"ACTION"
' WebElement_GetValue = Act_Value
' Else
' WebElement_GetValue = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, WebElement_GetValue,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get displayed value from a Combo box
'#Input Parameters:: Combobox Object
'#Return Values: Combo box value or error message
'#######################################################################################################################################################################
'Public Function Combo_Get(ObjCombo)
' Combo_Text = ObjCombo.ToString 'Capture Name of the Test Object
' If ObjCombo.Exist(5) Then 'Verify is the Combo box is exists
' Act_Value = ObjCombo.GetROProperty("selection") 'Capture value from Combo box
' Combo_Get = "Value "& Act_Value &" has been retrieved successfully from "& Combo_Text
' Gen_Report_Event micPass,"Get Value from "& Combo_Text, Combo_Get,"ACTION"
' Combo_Get = Act_Value
' Else
' Combo_Get = Combo_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Combo_Text, Combo_Get,"ACTION"
' End If
'End Function
'#################################################################################################################################
'#Function Description: The function is a generic function is used to Verify the displayed option from the given combo box
'#Input Parameters: Combo box Object, Option to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Combo_Verify(ObjCombo,Exp_Item)
'
' Combo_Text = ObjCombo.ToString 'Capture Name of the Test Object
' If ObjCombo.Exist(5) Then 'Verify is the combo box is exists
' Prty = ObjCombo.GetROProperty("visible") 'Verify is combo box is visible
' If Prty =True Then
' ElmtName = ObjCombo.GetSelection 'Get the displayed value from the combobox
' If ElmtName = Exp_Item Then
' Combo_Verify="'"&Exp_Item&"' is displayed successfully in " & Combo_Text
' Gen_Report_Event micPass,"Verify the displayed value in "& Combo_Text , Combo_Verify,"VERIFY"
' Combo_Verify=True
' Else
' Combo_Verify="Expected Value "&Exp_Item&" is not matched with Actual Value "&ElmtName& " in " & Combo_Text
' Gen_Report_Event micFail,"Verify '"& Exp_Item &"' is displayed in " & Combo_Text, Combo_Verify,"VERIFY"
' End If
' Else
' Gen_Report_Event micFail,"Verify "& Combo_Text & " ComboBox is visible" ,"'" & Combo_Text & " ComboBox is disabled","VERIFY"
' End If
' Else
' Gen_Report_Event micFail,"Verify for "& Combo_Text & "ComboBox", "'" & Combo_Text &" ComboBox doesn't exists ","VERIFY"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to set value to checkbox
'#Input Parameters:: Check box Object, value to be verified
'#Return Values: True/Error message
'#Ex: Checkbox_Select(ObjCheckbox,"ON")
'#######################################################################################################################################################################
Public Function Checkbox_Select(ObjCheckbox, Value_)
Checkbox_Text = ObjCheckbox.ToString 'Capture Name of the Test Object
Select Case True
Case Not ObjCheckbox.Exist
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" does not exist on current screen"
Checkbox_Select = False
Case ObjCheckbox.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" is not visible"
Checkbox_Select = False
Case ObjCheckbox.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" is disabled"
Checkbox_Select = False
Case Else
ObjCheckbox.Set Value_ 'Set Value to Check Box
Checkbox_Select = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: This function selects a tab
'#Input Parameters:: Tab Object, tab_item to select
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function Tab_Select(ObjTab, tab_item)
' Obj_Text = ObjTab.toString & "item: " & tab_item 'Capture Name of the Test Object
' If ObjTab.Exist(20) Then
' If ObjTab.WaitProperty ("visible",True, 10000)Then 'Verify the Tab box is visible
' If ObjTab.WaitProperty ("enabled",True, 10000)Then
' If TabsDisplayed(ObjTab,10) Then
' If TabExists(ObjTab, tab_item) Then
' Gen_Report_Event micPass,"Selecting Tab " & tab_item, Obj_Text, "ACTION"
' 'Check Visible after this report - Sync Issue S.No 2
' If ObjTab.WaitProperty ("visible",True, 10000)Then 'Verify the Tab box is visible
' ObjTab.Select tab_item
' Tab_Select = True
' Else
' Tab_Select = Obj_Text &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End if
' Else
' Tab_Select = Obj_Text &" is not displayed"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = tab_item &" is not found in the tab collection for Tab: " & Obj_Text
' Gen_Report_Event micFail,"Tab Item Not Found: " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = Obj_Text &" is not enabled"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = Obj_Text &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: This function waits until the tab count in a tab object is greater than 0
'#Input Parameters:: Tab Object, timeout in seconds
'#Return Values: True or False
'#######################################################################################################################################################################
'Public Function TabsDisplayed(ObjTab,timeout)
' endtime = Timer + timeout
' TabsDisplayed = False ' declare as not displayed
' Do
' tab_count = ObjTab.GetROProperty("items count")
' If tab_count > 0 Then ' tabs are displayed
' TabsDisplayed = True
' Exit Function
' End If
' Loop Until Timer > endtime
'End Function
'########################################################################################################################################################################
'#Function Description: This function checks if a tab item exists in a tab object
'#Input Parameters:: Tab Object, tab_item to check
'#Return Values: True, False
'#######################################################################################################################################################################
'Public Function TabExists(ObjTab, tab_name)
' TabExists = False
' For i=0 to ObjTab.GetROProperty("items count") -1
' If ObjTab.GetItem(i) = tab_name Then
' TabExists = True
' Exit Function
' End If
' Next
'End Function
'#################################################################################################################################################################
'#Function Description: This is a generic function used to select the menu item
'#Input Parameters: ObjMenu = Menu name
'# Menu_Item = Menu item to be selected
'#Return Values: True or error message
'#Example: Call Menu_Select(Property,Menu item with semicolon
'################################################################################################################################################################
'Public Function Menu_Select(ObjMenu, Menu_item)
' Obj_Menu = ObjMenu.toString ' & "item: " & Menu_item 'Capture Name of the Test Object
' If ObjMenu.Exist(5) Then 'Verify the Tab box exists
' If ObjMenu.GetItemProperty(Menu_item,"visible")=True Then
' ItemPath = ObjMenu.BuildMenuPath(Menu_item)
' ObjMenu.ExpandMenu = False
' ObjMenu.Select ItemPath
' Gen_Report_Event micPass,"Selecting Menu Item " &Menu_item &" from "&Obj_Menu, "","ACTION"
'' ObjMenu.Select Menu_item
' Menu_Select = True
' Else
' Menu_Select = Obj_Menu &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Menu " & Menu_item, Menu_Select,"VERIFY"
' End If
' Else
' Menu_Select = Obj_Menu &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Menu " & Menu_item, Menu_Select,"VERIFY"
' End If
'End Function
'########################################################################################################################################################################
'#Function Descrption: The function verifies is the given Button object is visible or not
'#Input Parameters:Button Object
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function Button_IsVisible(ObjButton, ExpStatus)
' Button = ObjButton.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' If ObjButton.Exist(2) Then 'Verify is the button exists
' Prpty = ObjButton.GetROProperty("visible") 'Capture enabled property of the object
' Select Case ExpStatus
' Case "YES","Y","ON", "ENABLED"
' If Prpty=True Then
' Button_IsVisible = True
' Gen_Report_Event micPass,"Verify "&Button&" Status", "Button is Visible","VERIFICATION"
' Else
' Button_IsVisible= Button&" is not enabled and IS expected to be"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
' Case "NO","N","OFF", "DISABLED"
' If Prpty=False Then
' Button_IsVisible = True
' Gen_Report_Event micPass,"Verify "&Button&" Status", "Button is disabled","VERIFICATION"
' Else
' Button_IsVisible= Button&" is visible and IS expected NOT to be"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
' Case Else
' Button_IsVisible = "Status not coded for: " & ExpStatus
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End Select
' Else
' Button_IsVisible =Button&" is not Visible"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies is the given Radio Button object is Set or not
'#Input Parameters:Radio Button Object
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function RadioButton_IsSet(ObjRadioBtn, ExpStatus)
' RadioBtn = ObjRadioBtn.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' If ObjRadioBtn.Exist(2) Then 'Verify is the button exists
' Prpty = ObjRadioBtn.GetROProperty("visible") 'Capture enabled property of the object
' If Prpty =True Then
' RadioButton_IsSet = RadioBtn&" is Visible"
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Prpty = ObjRadioBtn.GetROProperty("checked")
' Select Case ExpStatus
' Case "YES","Y","ON"
' If Prpty="ON" Then
' RadioButton_IsSet = True
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", "Radio Button is Set","VERIFICATION"
' Else
' RadioButton_IsSet = RadioBtn&" is not SET and IS expected to be"
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Case "NO","N","OFF"
' If Prpty="OFF" Then
' RadioButton_IsSet = True
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", "Radio Button is not SET", "VERIFICATION"
' Else
' RadioButton_IsSet = RadioBtn&" is set and IS NOT expected to be."
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Case Else
' RadioButton_IsSet = "Status not coded for: " & ExpStatus
' End Select
' Else
' RadioButton_IsSet =RadioBtn&" is not Visible"
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns value from the given excel sheet/excel object for the given row and column
'#Input Parameters:Excel file Name, Excel sheet name, Object Reference, Row number and Column Name
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Get_Cell_Value(vFileName,vSheet,objWorkSheet,Row,Col)
'
' CellValue=0
' iColNum=0
' If trim(vFileName) <> "" Then
' Set objExcel = CreateObject("Excel.Application") 'Create an Excel object
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' If trim(vSheet) <> "" Then
' Set objWorkSheet = objWorkBook.WorkSheets(vSheet)
' Else
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' End If
'
' x=1
' End If
' ColCount = objWorkSheet.UsedRange.columns.count+5 'Get Columns from the Excel file
' For i=1 to ColCount
' temp_col = objWorkSheet.Cells(1,i)
' If UCase(temp_col) = UCase(Col) Then 'Captures the column Index
' iColNum=i
' Exit For
' End If
' Next
' If iColNum=0 Then
' CellValue="NULL"
' Else
' CellValue=objWorkSheet.Cells(Row,iColNum) 'Return Cell value from the given row and column
' End If
' If x=1 Then
' objWorkBook.Close 'Deallocate the excel object
' Set objWorkBook =Nothing
' End If
' Get_Cell_Value=CellValue
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns the column name of a given extract for the given column index
'#Input Parameters: Extract location/Excel Object and column index
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Get_Column_Name(vFileName,objWorkSheet,Col)
' CellValue=0
' iColNum=0
' If trim(vFileName) <> "" Then
' Set objExcel = CreateObject("Excel.Application") 'Create an Excel object
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' x=1
' End If
' ColCount = objWorkSheet.UsedRange.columns.count+5 'Get Columns from the Excel file
' If ColCount < Col Then
' ColName=objWorkSheet.Cells(1,cint(Col))
' If IsNull(ColName) Then
' Get_Column_Name = "Blank Column Name"
' Else
' Get_Column_Name=ColName
' End If
' Else
' Get_Column_Name="Given Column Index is out of range"
' End If
' If x=1 Then
' objWorkBook.Close 'Deallocate the excel object
' Set objWorkBook =Nothing
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to save to Excel
'#Input Parameters::
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function Save_To_Excel(vWorkBook,vWorkSheet)
' Dim ObjExcel
' Dim ObjWorkBook
' Dim ObjWorksheet
' Dim vRow, vRow_Count, vCol_Index, vWorkSheet_index, vWorkSheet_Exists
' Dim Folder_Path_arr, vFolder_Path, vArray_Size
' Call Close_All_Excel_Files()
' ' Create the folder in the specified path if not exist
' Folder_Path_arr = Split(vWorkBook, "\")
' vFolder_Path = Folder_Path_arr(0)
' For vArray_Size = 1 To UBound(Folder_Path_arr) - 1
' vFolder_Path = vFolder_Path & "\"&Folder_Path_arr(vArray_Size)
' If Not Check_Folder_Exists(vFolder_Path) Then
' Create_Folder(vFolder_Path)
' End If
' Next
' Set ObjExcel = CreateObject("Excel.Application")
' If Check_File_Exists(vWorkBook) = False Then
' Set ObjWorkBook = ObjExcel.Workbooks.Add
' Set ObjWorksheet = ObjWorkBook.Sheets.Item(1)
' ObjWorkBook.Worksheets.Add.Name = vWorkSheet
' ObjWorkBook.SaveAs(vWorkBook)
' Save_To_Excel=True
' Else
' Set ObjWorkBook = ObjExcel.Workbooks.Open(vWorkBook)
' If Check_WorkSheet_Exists(ObjWorkbook,vWorkSheet) Then
' ObjExcel.DisplayAlerts = False
' ObjExcel.Worksheets(vWorkSheet).Delete
' ObjExcel.DisplayAlerts = True
' End If
' ObjExcel.Worksheets.Add.Name = vWorkSheet
' ObjWorkBook.Save
' Save_To_Excel=True
' End If
' Set ObjWorksheet = objWorkBook.Worksheets(vWorkSheet)
' ObjWorksheet.Activate
' ObjWorksheet.Paste
' ObjWorkBook.Save
' ObjWorkBook.Close True
' Set ObjWorksheet = Nothing
' Set ObjWorkBook = Nothing
' Set ObjExcel = Nothing
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to save to Excel
'#Input Parameters::
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function SaveButton_To_Excel(vWorkBook)
' Dim Folder_Path_arr, vFolder_Path, vArray_Size
' 'Call Close_All_Excel_Files()
' ' Create the folder in the specified path if not exist
' Folder_Path_arr = Split(vWorkBook, "\")
' vFolder_Path = Folder_Path_arr(0)
' For vArray_Size = 1 To UBound(Folder_Path_arr) - 1
' vFolder_Path = vFolder_Path & "\"&Folder_Path_arr(vArray_Size)
' If Not Check_Folder_Exists(vFolder_Path) Then
' Create_Folder(vFolder_Path)
' End If
' Next
' If Window("Microsoft Excel").Exist(10) Then
' Window("Microsoft Excel").Type micAltDwn + "f" + micAltUp
' Window("Microsoft Excel").Type "a"
' Window("Microsoft Excel").Window("Save As").Winobject("Filename").Type vWorkBook
' wait(2)
' Window("Microsoft Excel").Window("Save As").Click 548,320
' If Window("Microsoft Excel").Window("Save As").Dialog("Microsoft Excel").Exist(3) Then 'This is to replace the existing file with the same name
' Window("Microsoft Excel").Window("Save As").Dialog("Microsoft Excel").Winbutton("Yes").Click
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("Yes").Click
' End If
' End If
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("Yes").Click
' End If
' wait(2)
' Window("Microsoft Excel").Type micAltDwn + "f" + micAltUp
' Window("Microsoft Excel").Type "x"
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("No").Click
' End If
' SaveButton_To_Excel=True
' Else
' SaveButton_To_Excel= "Unable to Find the Microsoft Excel Window to save worksheet "&vWorkBook
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function terminates all the active windows excel processes
'#Input Parameters:None
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Close_All_Excel_Files()
' wait(2)
' strComputer = "."
' Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
' Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'Excel.exe'") 'Capture the active windows Excel Processes
' If colProcesses.Count > 0 Then
' For Each objProcess in colProcesses 'Terminate Excel Processes one by One
' objProcess.Terminate()
' wait(1)
' Next
' End If
'End Function
'Public Function Check_Folder_Exists(vFolder)
' Dim ObjFSO
' Set ObjFSO= CreateObject("Scripting.FileSystemObject")
' If (ObjFSO.FolderExists(vFolder)) Then
' Check_Folder_Exists = True
' Else
' Check_Folder_Exists = False
' End If
' Set ObjFSO = Nothing
'End Function
'
'Public Function Create_Folder(vFolder)
' Dim ObjFSO, ObjFldr
' Set ObjFSO = CreateObject("Scripting.FileSystemObject")
' Set ObjFldr = ObjFSO.CreateFolder(vFolder)
' Create_Folder = ObjFldr.Path
' Set ObjFSO = Nothing
'End Function
'
'Public Function Check_WorkSheet_Exists(ObjWorkbook,vWorkSheet)
' Dim vWorkSheet_index
' For vWorkSheet_index = 1 To ObjWorkBook.Sheets.Count
' If UCase(ObjWorkBook.WorkSheets(vWorkSheet_index).Name) = UCase(vWorkSheet) Then
' Check_WorkSheet_Exists = True
' Exit For
' Else
' Check_WorkSheet_Exists = False
' End If
' Next
'End Function
'
'Public Function Check_File_Exists(vFileName)
' Dim ObjFSO
' Set ObjFSO = CreateObject("Scripting.FileSystemObject")
' If (ObjFSO.FileExists(vFileName)) Then
' Check_File_Exists = True
' Else
' Check_File_Exists = False
' End If
' Set ObjFSO = Nothing
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies whether the given column is existing in the excel sheet
'#Input Parameters:Excel file Name, Excel sheet name, column Name and Value to be searched in the column
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Read_Exported_View(sFileName,vSheet,sFieldName,Val)
' Dim ObjFSO,ObjExcel,ObjWorkBook,ObjWorkSheet,OSearchRegion,OSearchResult
' Dim iColNum
' iColNum=0
' Set ObjFSO=CreateObject("Scripting.FileSystemObject")
' If ObjFSO.FileExists(sFileName) Then
' Set ObjExcel = CreateObject("Excel.Application") 'Create Excel Object
' Set ObjWorkBook = objExcel.Workbooks.Open (sFileName)
' Set ObjWorkSheet = objWorkBook.WorkSheets(vSheet)
' ColCount = ObjWorkSheet.UsedRange.columns.count+5 'Capture the number of columns
' Row_Count = ObjWorkSheet.UsedRange.Rows.count 'Capture the number of rows
' Set OSearchRegion = ObjWorkSheet.Range(ObjWorkSheet.cells(1,1),ObjWorkSheet.cells(1, ColCount ))
' notfound = ""
' Set OSearchResult = OSearchRegion.Find(sFieldName) 'Search for a given column name
' If not OSearchResult is nothing then
' iColNum = OSearchResult.column
' If trim(Val) <> "" Then
' Read_Exported_View="Failed to find the required text from the exported view"
' For i=2 to Row_Count
' temp_val = ObjWorkSheet.Rows(i).Columns(iColNum).Value 'Search for a given Value
' If trim(temp_val) = trim(Val) Then
' Read_Exported_View=True
' Exit For
' End If
' Next
' Else
' Read_Exported_View=True
' End If
' Else
' Read_Exported_View="Column Not found"
' End If
' ObjWorkBook.Close
' Set ObjWorkBook =Nothing
' Else
' Read_Exported_View=sFileName&" File not found "
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns the number of used rows of a specified excel workbook and worksheet or returns number of used rows from a given excel object
'#Input Parameters:Excel file Name, Excel sheet name, Excel object
'#Return Values: Used row count
'#######################################################################################################################################################################
'Public Function Get_Exported_View_Row_Count(vFileName,vSheet,objWorkSheet)
' CellValue=0
' iColNum=0
' Set FSO=CreateObject("Scripting.FileSystemObject")
' If FSO.FileExists(vFileName) Then
'' If trim(vFileName) <> "" and trim(vSheet) <> "" Then 'Check for null values of excel file and sheet
' If trim(vFileName) <> "" Then 'Check for null values of excel file and sheet
' Set objExcel = CreateObject("Excel.Application")
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' If trim(vSheet) <> "" Then
' Set objWorkSheet = objWorkBook.WorkSheets(vSheet)
' Else
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' End If
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Returns number of rows from the given excel file and sheet
' objWorkBook.Close
' Set objWorkBook =Nothing
' ElseIf not objWorkSheet is Nothing Then 'Check for the null excel excel object
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Return number of used rows from the given excel object
' Set objWorkSheet = Nothing
' Else
' Get_Exported_View_Row_Count =0
' End If
' ElseIf not objWorkSheet is Nothing Then
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Return number of used rows from the given excel object
' Set objWorkSheet = Nothing
' Else
' Reporter.ReportEvent micFail, "Find Exported View or Object",vFileName&" File not found or null Object"
' End If
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Rowno(Local_Sheet, Verify_Field, Verify_Field_Val, Row_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' TotLoc_Row = Loc_Range.Rows.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Ucase(Trim(Loc_xl.Application.Cells(1,J))) = trim(UCase(Verify_Field)) Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' Row_no = 0
' If Loc_colno <>0 Then
' For Loc_Row = 1 to TotLoc_Row - 1
' Loc_val = Loc_xl.Application.Cells(Loc_Row+1,Loc_colno)
' 'The issue is with Date column on CSV. Date by default gets converted to MM/DD/YY
' If UCase(Right(Local_Sheet, 3)) = "CSV" Then
' If Isdate(Loc_val) Then
' Loc_val = cstr(DATEVALUE(MID(Loc_val,4,2)&"/"&LEFT(Loc_val,2)&"/"&RIGHT(Loc_val,2)))
' End If
' End If
' If Ucase(Trim(Loc_val)) =Ucase(Trim(Verify_Field_val)) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' Get_Table_Rowno = Row_no
' End If
' Next
' Else
' Row_no = 0
' End If
' Get_Table_Rowno = Row_no
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Columnno(Local_Sheet, Verify_Field, Col_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range = Loc_Sht.UsedRange
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If UCase(Trim(Loc_xl.Application.Cells(1,J))) =UCase(Verify_Field) Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' If Loc_colno <>0 Then
' Col_no = Loc_colno
' Else
' Col_no = 0
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Columnval(Local_Sheet, Verify_Field, Record_Number, Col_val)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' If Loc_colno <>0 Then
' Col_val = Loc_xl.Application.Cells(Record_Number+1, Loc_colno) '+1 to skip the header
' 'The issue is with Date column on CSV. Date by default gets converted to MM/DD/YY
' If UCase(Right(Local_Sheet, 3)) = "CSV" Then
' If Isdate(Loc_val) Then
' Loc_val = cstr(DATEVALUE(MID(Loc_val,4,2)&"/"&LEFT(Loc_val,2)&"/"&RIGHT(Loc_val,2)))
' End If
' End If
' Else
' Col_val =""
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Get the number of Table Row Count
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_FieldValueCount(Local_Sheet, Verify_Field, Field_Value, Field_Count)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' Field_Count = 0
' If Loc_colno <>0 Then
' While (Loc_xl.Application.Cells(Loc_Row+1,1).Value) <> ""
' If Field_Value = Loc_xl.Application.Cells(Loc_Row+1, Loc_colno) Then '+1 to skip the header
' Field_Count = Field_Count + 1
' End If
' Loc_Row = Loc_Row + 1
' Wend
' End If
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Get the value of the table specified for multi column values
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Rowno_Multi(Local_Sheet, Verify_Field, Verify_Field_Val, Row_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_column = ""
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' TotLoc_Row = Loc_Range.Rows.Count
' Loc_xl.DisplayAlerts = False
' Verify_field_arr = Split(Verify_Field, ":", -1, 1)
' For I = 0 to UBound(Verify_field_arr)
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field_arr(I) Then
' Loc_column = Loc_column & J & ":"
' J = TotLoc_Col + 1
' End If
' Next
' Next
' Row_no = 0
' If Loc_column <> "" Then
' For Loc_Row = 1 to TotLoc_Row - 1
' Loc_val = ""
' Local_Column_arr = Split(Loc_column,":", -1, 1)
' For I = 0 to UBound(Local_Column_arr)
' If Local_Column_arr(I) <> "" Then
' Loc_val = Loc_val & Loc_xl.Application.Cells(Loc_Row+1,int(Local_Column_arr(I)))
' End If
' Next
' If isnumeric(Loc_val) Then
' If int(Loc_val) =int(Verify_Field_val) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' End If
' Else
' If Trim(Loc_val) =Trim(Verify_Field_val) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' End If
' End If
' Next
' Else
' Row_no = 0
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = No
Command Set
Public LOG_LEVEL, REPORT_TYPE
LOG_LEVEL = 4
REPORT_TYPE = 6
'########################################################################################################################################################################
'#Function Description: Click on the specific link for the object button
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("View/change payments").Link("Confirm")
'# Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebButton("Confirm"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Object_Click(Obj)
Object_Text = Obj.ToString
Select Case True
Case Not Obj.Exist
ReportStepResult Test_Step_Id, "Failed", Object_Text & " does not exist on current page"
Object_Click = False
Case Obj.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is not visible"
Object_Click = False
Case Obj.GetROProperty("micclass") = "WinButton"
If Obj.GetROProperty("enabled") = False Then
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_Click = False
Else
Obj.Click
Object_Click=True
End If
Case Obj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_DoubleClick = False
Case Else
Obj.Click
Object_Click=True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Double-Click on the specific link for the object
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("View/change payments").Link("Confirm")
'# Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebButton("Confirm"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Object_DoubleClick(Obj)
Object_Text = Obj.ToString
Select Case True
Case Not Obj.Exist
ReportStepResult Test_Step_Id, "Failed", Object_Text & " does not exist on current page"
Object_DoubleClick = False
Case Obj.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is not visible"
Object_DoubleClick = False
Case Obj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Object_Text & " is disabled"
Object_DoubleClick = False
Case Else
Obj.Click
Obj.FireEvent "ondblclick"
Object_DoubleClick = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Verify the combo exists and check it the item is available on combo and select the item
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"))
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Combo_Select(ObjCombo,Exp_Item)
Combo_Text = ObjCombo.ToString
Select Case True
Case Not ObjCombo.Exist
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " does not exist on current page"
Combo_Select = False
Case ObjCombo.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " is not visible"
Combo_Select = False
Case ObjCombbject.isDisabled
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " is disabled"
Combo_Select = False
Case ObjCombo.GetROProperty("items count") = 0
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " does not have any items to select"
Combo_Select = False
Case Else
For i=1 to ObjCombo.GetROProperty("items count")
Item_ = ObjCombo.GetItem(i)
If Instr(1, Trim(Item_), Trim(Exp_Item), 1) > 0 Then
ObjCombo.Select Item_
Combo_Select = True
Exit For
End If
Next
End Select
If Combo_Select <> True Then
ReportStepResult Test_Step_Id, "Failed", "Unable to select " & Exp_Item & " from " & Combo_Text
Combo_Select = False
End If
End Function
'########################################################################################################################################################################
'#Function Description: The function sets the given radio button object
'#Input Parameters:Radio button object (e.g. Set Obj = Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebRadioGroup("PaymentTransferType"))
'#Return Values: True/Error Message
'#######################################################################################################################################################################
Public Function Set_Radio_Group_Button(BtnObj,GrpId)
If Left(GrpId, 1) = "#" Then
GrpId = Right(GrpId, Len(GrpId) -1)
End If
Select Case True
Case Not BtnObj.Exist
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " doesn't exist"
Set_Radio_Group_Button=False
Case BtnObj.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " is disabled"
Set_Radio_Group_Button=False
Case BtnObj.GetROProperty("visible") <> True
ReportStepResult Test_Step_Id, "Failed", BtnObj.ToString & " is not visible"
Set_Radio_Group_Button=False
Case Else
BtnObj.Select "#" & GrpId
Set_Radio_Group_Button = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: Verify the combo exists and select based on Item no
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"),"#3")
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Combo_Select_Item(ObjCombo,Exp_Item_No)
Combo_Text = ObjCombo.ToString
If ObjCombo.Exist Then
Prty = ObjCombo.GetROProperty("visible")
If Prty =True Then
If instr(Exp_Item_No,"#") > 0 Then
Item_No = Cint(Replace(Exp_Item_No,"#",""))
Else
Item_No = Cint(Exp_Item_No)
End If
Item_ = ObjCombo.GetItem(Item_No + 1)
ObjCombo.Select Item_
Combo_Select_Item = True
Else
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " combo box is not visible"
Combo_Select_Item = False
End If
Else
ReportStepResult Test_Step_Id, "Failed", Combo_Text & " combo box does not exist on current page"
Combo_Select_Item = False
End If
End Function
'########################################################################################################################################################################
'#Function Description: Verify the List exists and return the active status
'#Input Parameters: (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebList("PaymentDate"))
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function List_Verify(ObjList,Exp_Item)
'
' Listbox_Text = ObjList.ToString
' If ObjList.Exist Then
' Prty=ObjList.GetROProperty("visible")
' If Prty =True Then
' Item_count = ObjList.GetRoProperty("items count")
' If Item_count > 0 Then
' For i=1 to Item_count
' Item_ = ObjList.GetItem(i)
' If UCase(Trim(Item_)) = UCase(Trim(Exp_Item)) Then
' List_Verify=True
' Exit For
' End If
' Next
' If List_Verify <> True Then
' ReportStepResult Test_Step_Id, "Failed", Exp_Item & " does not exist in " & Listbox_Text
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box does not have any items to select"
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box is not visible"
' List_Verify = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Listbox_Text & " list box does not exist on current screen"
' List_Verify = False
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is used to Set the text in edit box
'#Input Parameters:: Object and value to be Set in (e.g. Browser("cabutara Wealth Online").Page("Make a payment/transfer").WebEdit("recipientName"),1234)
'#Return Values: True/False
'#######################################################################################################################################################################
Public Function Edit_Set(ObjEdit, Value_)
Edit_Text = ObjEdit.ToString
Select Case True
Case Not ObjEdit.Exist
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " does not exist on current screen"
Edit_Set = False
Case ObjEdit.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " is not visible"
Edit_Set = False
Case Not ObjEdit.Object.isContentEditable
ReportStepResult Test_Step_Id, "Failed", Edit_Text & " is disabled and cannot be changed"
Edit_Set = False
Case Else
ObjEdit.Set Value_
Edit_Set = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: The function is used to Type in a text in edit box
'#Input Parameters:: Object and value to be typed in
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Edit_Type(ObjEdit, Value_)
'
' Edit_Text = ObjEdit.ToString
' If ObjEdit.Exist Then
' Prpty = ObjEdit.GetROProperty("visible")
' If Prpty =True Then
' ObjEdit.Type Value_
' Edit_Type= True
' Else
' ReportStepResult Test_Step_Id, "Failed", Edit_Text & " edit box is not visible"
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Edit_Text & " edit box does not exist on current screen"
' End If
'
' End Function
'########################################################################################################################################################################
'#Function Description: The function is select the specific tab on the application any object
'#Input Parameters:: Object
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Obj_Tab(Obj)
'
' If Obj.Exist Then
' Prpty = Obj.GetROProperty("visible")
' If Prpty =True Then
' ObjEdit.Type micTab
' Obj_Tab = True
' Else
' ReportStepResult Test_Step_Id, "Failed", Obj & " is not visible"
' Obj_Tab = False
' End If
' Else
' ReportStepResult Test_Step_Id, "Failed", Obj & " does not exist on current screen"
' Obj_Tab = False
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies is the given check box object is checked or not
'#Input Parameters:Check Box Object
'
'
' Amend to cater for Prpty = ObjChkbox.GetROProperty("checked") == ON/1 or OFF/0
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function Checkbox_IsChecked(ObjChkbox, ExpStatus)
'
' Chkbox = ObjChkbox.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' Const GWL_STYLE=-16
' If ObjChkbox.Exist(2) Then 'Verify is the button exists
' Prpty = ObjChkbox.GetROProperty("visible") 'Capture visible property of the object
' If Prpty =True Then
' Checkbox_IsChecked = Chkbox&" is visible"
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Prpty = ObjChkbox.GetROProperty("checked")
' Select Case ExpStatus
' Case "YES","Y","ON"
' If (Prpty="ON") OR (Prpty = 1) Then
' Checkbox_IsChecked = True
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", "CheckBox is checked","VERIFICATION"
' Else
' Checkbox_IsChecked = Chkbox&" is not checked and IS expected to be"
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Case "NO","N","OFF"
' If (Prpty="OFF") OR (Prpty = 0) Then
' Checkbox_IsChecked = True
' Gen_Report_Event micPass,"Verify "&Chkbox&" Status", "CheckBox is not checked", "VERIFICATION"
' Else
' Checkbox_IsChecked = Chkbox&" is checked and IS NOT expected to be."
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
' Case Else
' Checkbox_IsChecked = "Status not coded for: " & ExpStatus
' End Select
' Else
' Checkbox_IsChecked =Chkbox&" is not Visible"
' Gen_Report_Event micFail,"Verify "&Chkbox&" Status", Checkbox_IsChecked,"VERIFICATION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to set value to an Edit box
'#Input Parameters:: Edit box Object, value to be verified
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function Edit_Verify(ObjEdit, Value_)
'
' Edit_Text = ObjEdit.ToString 'Capture Name of the Test Object
' If ObjEdit.Exist Then 'Verify is the Edit box is exists
' Gen_Report_Event micPass,Edit_Text&" found Successfully ", "","VERIFICATION"
' Act_Value = ObjEdit.GetROProperty("text") 'Capture value from edit box
' If IsDate(Value_) Then
' If Act_Value = "" Then
' Act_Value = 0
' End If
' If CDate(Act_Value)=CDate(Value_) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' ElseIf IsNumeric(Value_) Then
' If Act_Value = "" Then
' Act_Value = 0
' End If
' If Round(Replace(Act_Value,",",""),2) = Round(Replace(Value_,",",""),2) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' Else
' If UCase(Trim(Replace(Act_Value,",","")))=UCase(Trim(Replace(Value_,",",""))) Then 'Compare the edit box value with the expected value
' Edit_Verify = "Expected Value "&Value_&" has been verifiied Successfully with Actual Value "&Act_Value
' Gen_Report_Event micPass,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' Edit_Verify = True
' Else
' Edit_Verify = "Expected Value "&Value_&" is not matched with Actual Value "&Act_Value
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
' End If
' Else
' Edit_Verify = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Verify "&Value_&" from "&Edit_Text, Edit_Verify,"VERIFICATION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function captures the snapshot of the desktop by using windows API calls
'#Input Parameters:None
'#Return Values: None
'#######################################################################################################################################################################
'Public Function AltPrintScreen()
'
' Const KEYEVENTF_KEYUP = "&H2"
' Const VK_SNAPSHOT= "&H2C"
' Const VK_MENU = "&H12"
' extern.Declare micVoid,"keybd_event","user32","keybd_event", micByte, micByte, micLong, micLong
' extern.Declare micHwnd ,"GetClipboardData","user32","GetClipboardData", micUInteger
' Extern.keybd_event VK_MENU, 0, 0, 0
' Extern.keybd_event VK_SNAPSHOT, 0, 0, 0
' Extern.keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
' Extern.keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function captures the snap shots of the error/warning message popped up during the execution and saves them in a predefined location
'#Input Parameters:Error Message to be written into the word file
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Capture_Snap_Shot(Err_Msg)
'
' Call Check_Snapshot_File() 'Verify whether the snapshot file is available or not.
' Set objWD = CreateObject("Word.Application") 'Create word document
' Set wrdDoc = objWD.Documents.Open(snap_shots_file)
' Set trange = wrdDoc.Content
' trange.Paragraphs.Add 'Create Paragraphs
' pc = wrdDoc.Paragraphs.Count
' StartRange = wrdDoc.Paragraphs(pc).Range.Start
' EndRange = wrdDoc.Paragraphs(pc).Range.End
' trange.SetRange StartRange,EndRange
' trange.Text="Test Name: "&Environment("TestName")&" Action Name: "&Environment("ActionName")&Chr(13)&Err_Msg&Chr(13)
' trange.Paragraphs.Add
' pc = wrdDoc.Paragraphs.Count
' StartRange = wrdDoc.Paragraphs(pc).Range.Start
' EndRange = wrdDoc.Paragraphs(pc).Range.End
' trange.SetRange StartRange,EndRange
' Call AltPrintScreen() 'Capture snap shot
' tRange.Paste 'Save the snap shot captured in a word file
' objWD.ActiveDocument.Save
' objWD.Quit
' Set objWD = Nothing
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function deletes files at the given folder
'#Input Parametersictionary object with absolute path of folder location
'#Return Values: True/Error Message based on execution status
'#######################################################################################################################################################################
'Public Function Delete_All_files(fldr)
'
' Dim fso
' Set fso = CreateObject("Scripting.filesystemobject") 'Create file system object
' If fso.folderExists(fldr) Then 'Verify is the folder exists
' Set oFolder = fso.GetFolder(fldr)
' For Each oFile In oFolder.Files 'Access file by file
' oFile.Delete True 'setting force to true to delete readonly files
' Next
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: Check if the file exists on specified path
'#Input Parameters: Path +File name string
'#Return Values: True/Error Message
'#######################################################################################################################################################################
'Public Function File_Exists(pathName)
'
' Dim objFSO
' Set objFSO = CreateObject("Scripting.FileSystemObject")
' File_Exists = objFSO.FileExists(pathName) ' check for file
' Set objFSO=nothing
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function fetches data from database and saves the record set into a given xml file
'#Input Parametersictionary object database server name, database name, db username, db password, query to be executed and full path of file where recordset need to be stored
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Save_RecordSet(Srvr,Uid,Pwd,Query,Exp_Loc)
'
' Set objCONN = CreateObject("ADODB.Connection") 'Create connection object
' Set objRS=CreateObject("ADODB.RecordSet") 'Create Record set object
' objCONN.CommandTimeout=1000 'Set command timeoutr limit
' '{Oracle in instantclient11_1};dbq=TWPSIT; Uid=TEST_RW_USER; Pwd=w1ckham!1
' objCONN.ConnectionString="DRIVER={Oracle in instantclient11_1};dbq="&Srvr&";UID="&Uid&";PWD="&Pwd 'Establish a Database connection
' objCONN.Open 'Open db connection
' If objCONN.State = 1 Then 'verify db connection status
' Gen_Report_Event micPass,"Verify Database Connection ", "Database connection has been established successfully","VERIFICATION"
' Gen_Report_Event micDone,"Execute Query", Query,"ACTION"
' objRS.open Query,objCONN 'Execute the given query
' If objFso.FileExists(Exp_Loc) Then 'Delete the existing recordset extract
' Set f = objFso.GetFile(Exp_Loc)
' f.Delete
' End If
' objRS.Save Exp_Loc,1 'Save Record set
' If objRS.State = 1 Then
' objRS.Close 'Close Database connection
' End If
' objCONN.Close 'Close connection
' Status=True
' Else
' Status="Failed to establish Database connection "
' End If
' Save_RecordSet =Status
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function executes a given query on against a specified database
'#Input Parametersictionary object database server name, database name, db username, db password and query to be executed
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Execute_DB_Query(Srvr,Uid,Pwd,Query)
'
' Set objCONN = CreateObject("ADODB.Connection") 'Create connection object
' Set objRS=CreateObject("ADODB.RecordSet") 'Create Record set object
' objCONN.CommandTimeout=1000 'Set command timeoutr limit
' objCONN.ConnectionString="DRIVER={Oracle in instantclient11_1};dbq="&Srvr&";UID="&Uid&";PWD="&Pwd 'Establish a Database connection
' objCONN.Open 'Open db connection
' If objCONN.State = 1 Then 'verify db connection status
' objRS.open Query,objCONN 'Execute the given query
' If objRS.State = 1 Then
' objRS.Close 'Close Database connection
' End If
' objCONN.Close 'Close connection
' Status=True
' Else
' Status="Failed to establish Database connection "
' End If
' Execute_DB_Query=Status
'
'End Function
'########################################################################################################################################################################
'#Function Description: Function to retrieve clipboard data
'#Input Parameters:None
'#Return Values: Clipboard data
'#######################################################################################################################################################################
'Public function Get_Clipboard_Data()
'
' Set objHTML = CreateObject("htmlfile")
' Get_Clipboard_Data = objHTML.ParentWindow.ClipboardData.GetData("text")
' Set objHTML = nothing
'
'End function
'########################################################################################################################################################################
'#Function Description: The function halts the execution until the maximum time specified or the given object is invoked, whichever occurs first
'#Input Parameters:: Object and maximum timelimit
'#Return Values: True/False
'#######################################################################################################################################################################
'Public Function Wait_Until_Load(Obj,max_time)
'
' blndone=False
' counter=0
' Do While not(blndone)
' If Obj.Exist(0) Then 'Poll for every 2 secs, to verify the existance of the object
' blndone=True
' Exit Do
' Else
' If (counter > max_time) Then
' Exit Do
' Else
' wait(1)
' counter=counter+2
' End If
' End If
' Loop
' Wait_Until_Load=blndone
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Edit box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function Edit_Get(ObjEdit)
'
' Edit_Text = ObjEdit.ToString 'Capture Name of the Test Object
' If ObjEdit.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjEdit.GetROProperty("text") 'Capture value from edit box
' Edit_Get = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get text from "&Edit_Text, Edit_Get,"ACTION"
' Edit_Get = Act_Value
' Else
' Edit_Get = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, Edit_Get,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Web Element box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function WebElement_Get(ObjElement)
'
' Edit_Text = ObjElement.ToString 'Capture Name of the Test Object
' If ObjElement.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjElement.GetROProperty("innertext") 'Capture value from edit box
' WebElement_Get = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get innertext from "&Edit_Text, WebElement_Get,"ACTION"
' WebElement_Get = Act_Value
' Else
' WebElement_Get = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, WebElement_Get,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get value from a text box
'#Input Parameters:: Web Element box Object
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function WebElement_GetValue(ObjElement)
'
' Edit_Text = ObjElement.ToString 'Capture Name of the Test Object
' If ObjElement.Exist Then 'Verify is the Edit box is exists
' Act_Value = ObjElement.GetROProperty("value") 'Capture value from edit box
' WebElement_GetValue = "Value "&Act_Value&" has been retrieved successfully from "&Edit_Text
' Gen_Report_Event micPass,"Get 'value' from "&Edit_Text, WebElement_GetValue,"ACTION"
' WebElement_GetValue = Act_Value
' Else
' WebElement_GetValue = Edit_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Edit_Text, WebElement_GetValue,"ACTION"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to get displayed value from a Combo box
'#Input Parameters:: Combobox Object
'#Return Values: Combo box value or error message
'#######################################################################################################################################################################
'Public Function Combo_Get(ObjCombo)
' Combo_Text = ObjCombo.ToString 'Capture Name of the Test Object
' If ObjCombo.Exist(5) Then 'Verify is the Combo box is exists
' Act_Value = ObjCombo.GetROProperty("selection") 'Capture value from Combo box
' Combo_Get = "Value "& Act_Value &" has been retrieved successfully from "& Combo_Text
' Gen_Report_Event micPass,"Get Value from "& Combo_Text, Combo_Get,"ACTION"
' Combo_Get = Act_Value
' Else
' Combo_Get = Combo_Text&" is not visible"
' Gen_Report_Event micFail,"Get text from "&Combo_Text, Combo_Get,"ACTION"
' End If
'End Function
'#################################################################################################################################
'#Function Description: The function is a generic function is used to Verify the displayed option from the given combo box
'#Input Parameters: Combo box Object, Option to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Combo_Verify(ObjCombo,Exp_Item)
'
' Combo_Text = ObjCombo.ToString 'Capture Name of the Test Object
' If ObjCombo.Exist(5) Then 'Verify is the combo box is exists
' Prty = ObjCombo.GetROProperty("visible") 'Verify is combo box is visible
' If Prty =True Then
' ElmtName = ObjCombo.GetSelection 'Get the displayed value from the combobox
' If ElmtName = Exp_Item Then
' Combo_Verify="'"&Exp_Item&"' is displayed successfully in " & Combo_Text
' Gen_Report_Event micPass,"Verify the displayed value in "& Combo_Text , Combo_Verify,"VERIFY"
' Combo_Verify=True
' Else
' Combo_Verify="Expected Value "&Exp_Item&" is not matched with Actual Value "&ElmtName& " in " & Combo_Text
' Gen_Report_Event micFail,"Verify '"& Exp_Item &"' is displayed in " & Combo_Text, Combo_Verify,"VERIFY"
' End If
' Else
' Gen_Report_Event micFail,"Verify "& Combo_Text & " ComboBox is visible" ,"'" & Combo_Text & " ComboBox is disabled","VERIFY"
' End If
' Else
' Gen_Report_Event micFail,"Verify for "& Combo_Text & "ComboBox", "'" & Combo_Text &" ComboBox doesn't exists ","VERIFY"
' End If
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to set value to checkbox
'#Input Parameters:: Check box Object, value to be verified
'#Return Values: True/Error message
'#Ex: Checkbox_Select(ObjCheckbox,"ON")
'#######################################################################################################################################################################
Public Function Checkbox_Select(ObjCheckbox, Value_)
Checkbox_Text = ObjCheckbox.ToString 'Capture Name of the Test Object
Select Case True
Case Not ObjCheckbox.Exist
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" does not exist on current screen"
Checkbox_Select = False
Case ObjCheckbox.GetROProperty("visible") = False
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" is not visible"
Checkbox_Select = False
Case ObjCheckbox.Object.isDisabled
ReportStepResult Test_Step_Id, "Failed", Checkbox_Text &" is disabled"
Checkbox_Select = False
Case Else
ObjCheckbox.Set Value_ 'Set Value to Check Box
Checkbox_Select = True
End Select
End Function
'########################################################################################################################################################################
'#Function Description: This function selects a tab
'#Input Parameters:: Tab Object, tab_item to select
'#Return Values: Text box value or error message
'#######################################################################################################################################################################
'Public Function Tab_Select(ObjTab, tab_item)
' Obj_Text = ObjTab.toString & "item: " & tab_item 'Capture Name of the Test Object
' If ObjTab.Exist(20) Then
' If ObjTab.WaitProperty ("visible",True, 10000)Then 'Verify the Tab box is visible
' If ObjTab.WaitProperty ("enabled",True, 10000)Then
' If TabsDisplayed(ObjTab,10) Then
' If TabExists(ObjTab, tab_item) Then
' Gen_Report_Event micPass,"Selecting Tab " & tab_item, Obj_Text, "ACTION"
' 'Check Visible after this report - Sync Issue S.No 2
' If ObjTab.WaitProperty ("visible",True, 10000)Then 'Verify the Tab box is visible
' ObjTab.Select tab_item
' Tab_Select = True
' Else
' Tab_Select = Obj_Text &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End if
' Else
' Tab_Select = Obj_Text &" is not displayed"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = tab_item &" is not found in the tab collection for Tab: " & Obj_Text
' Gen_Report_Event micFail,"Tab Item Not Found: " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = Obj_Text &" is not enabled"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' Else
' Tab_Select = Obj_Text &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Tab " & tab_item, Obj_Text, "ACTION"
' End If
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: This function waits until the tab count in a tab object is greater than 0
'#Input Parameters:: Tab Object, timeout in seconds
'#Return Values: True or False
'#######################################################################################################################################################################
'Public Function TabsDisplayed(ObjTab,timeout)
' endtime = Timer + timeout
' TabsDisplayed = False ' declare as not displayed
' Do
' tab_count = ObjTab.GetROProperty("items count")
' If tab_count > 0 Then ' tabs are displayed
' TabsDisplayed = True
' Exit Function
' End If
' Loop Until Timer > endtime
'End Function
'########################################################################################################################################################################
'#Function Description: This function checks if a tab item exists in a tab object
'#Input Parameters:: Tab Object, tab_item to check
'#Return Values: True, False
'#######################################################################################################################################################################
'Public Function TabExists(ObjTab, tab_name)
' TabExists = False
' For i=0 to ObjTab.GetROProperty("items count") -1
' If ObjTab.GetItem(i) = tab_name Then
' TabExists = True
' Exit Function
' End If
' Next
'End Function
'#################################################################################################################################################################
'#Function Description: This is a generic function used to select the menu item
'#Input Parameters: ObjMenu = Menu name
'# Menu_Item = Menu item to be selected
'#Return Values: True or error message
'#Example: Call Menu_Select(Property,Menu item with semicolon
'################################################################################################################################################################
'Public Function Menu_Select(ObjMenu, Menu_item)
' Obj_Menu = ObjMenu.toString ' & "item: " & Menu_item 'Capture Name of the Test Object
' If ObjMenu.Exist(5) Then 'Verify the Tab box exists
' If ObjMenu.GetItemProperty(Menu_item,"visible")=True Then
' ItemPath = ObjMenu.BuildMenuPath(Menu_item)
' ObjMenu.ExpandMenu = False
' ObjMenu.Select ItemPath
' Gen_Report_Event micPass,"Selecting Menu Item " &Menu_item &" from "&Obj_Menu, "","ACTION"
'' ObjMenu.Select Menu_item
' Menu_Select = True
' Else
' Menu_Select = Obj_Menu &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Menu " & Menu_item, Menu_Select,"VERIFY"
' End If
' Else
' Menu_Select = Obj_Menu &" is not visible"
' Gen_Report_Event micFail,"Cannot Select Menu " & Menu_item, Menu_Select,"VERIFY"
' End If
'End Function
'########################################################################################################################################################################
'#Function Descrption: The function verifies is the given Button object is visible or not
'#Input Parameters:Button Object
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function Button_IsVisible(ObjButton, ExpStatus)
' Button = ObjButton.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' If ObjButton.Exist(2) Then 'Verify is the button exists
' Prpty = ObjButton.GetROProperty("visible") 'Capture enabled property of the object
' Select Case ExpStatus
' Case "YES","Y","ON", "ENABLED"
' If Prpty=True Then
' Button_IsVisible = True
' Gen_Report_Event micPass,"Verify "&Button&" Status", "Button is Visible","VERIFICATION"
' Else
' Button_IsVisible= Button&" is not enabled and IS expected to be"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
' Case "NO","N","OFF", "DISABLED"
' If Prpty=False Then
' Button_IsVisible = True
' Gen_Report_Event micPass,"Verify "&Button&" Status", "Button is disabled","VERIFICATION"
' Else
' Button_IsVisible= Button&" is visible and IS expected NOT to be"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
' Case Else
' Button_IsVisible = "Status not coded for: " & ExpStatus
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End Select
' Else
' Button_IsVisible =Button&" is not Visible"
' Gen_Report_Event micFail,"Verify "&Button&" Status", Button_IsVisible,"VERIFICATION"
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies is the given Radio Button object is Set or not
'#Input Parameters:Radio Button Object
'#Return Values: True or error message
'#######################################################################################################################################################################
'Public Function RadioButton_IsSet(ObjRadioBtn, ExpStatus)
' RadioBtn = ObjRadioBtn.ToString 'Capture Button test Object Name
' ExpStatus = Ucase(Trim(ExpStatus))
' If ObjRadioBtn.Exist(2) Then 'Verify is the button exists
' Prpty = ObjRadioBtn.GetROProperty("visible") 'Capture enabled property of the object
' If Prpty =True Then
' RadioButton_IsSet = RadioBtn&" is Visible"
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Prpty = ObjRadioBtn.GetROProperty("checked")
' Select Case ExpStatus
' Case "YES","Y","ON"
' If Prpty="ON" Then
' RadioButton_IsSet = True
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", "Radio Button is Set","VERIFICATION"
' Else
' RadioButton_IsSet = RadioBtn&" is not SET and IS expected to be"
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Case "NO","N","OFF"
' If Prpty="OFF" Then
' RadioButton_IsSet = True
' Gen_Report_Event micPass,"Verify "&RadioBtn&" Status", "Radio Button is not SET", "VERIFICATION"
' Else
' RadioButton_IsSet = RadioBtn&" is set and IS NOT expected to be."
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
' Case Else
' RadioButton_IsSet = "Status not coded for: " & ExpStatus
' End Select
' Else
' RadioButton_IsSet =RadioBtn&" is not Visible"
' Gen_Report_Event micFail,"Verify "&RadioBtn&" Status", RadioButton_IsSet,"VERIFICATION"
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns value from the given excel sheet/excel object for the given row and column
'#Input Parameters:Excel file Name, Excel sheet name, Object Reference, Row number and Column Name
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Get_Cell_Value(vFileName,vSheet,objWorkSheet,Row,Col)
'
' CellValue=0
' iColNum=0
' If trim(vFileName) <> "" Then
' Set objExcel = CreateObject("Excel.Application") 'Create an Excel object
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' If trim(vSheet) <> "" Then
' Set objWorkSheet = objWorkBook.WorkSheets(vSheet)
' Else
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' End If
'
' x=1
' End If
' ColCount = objWorkSheet.UsedRange.columns.count+5 'Get Columns from the Excel file
' For i=1 to ColCount
' temp_col = objWorkSheet.Cells(1,i)
' If UCase(temp_col) = UCase(Col) Then 'Captures the column Index
' iColNum=i
' Exit For
' End If
' Next
' If iColNum=0 Then
' CellValue="NULL"
' Else
' CellValue=objWorkSheet.Cells(Row,iColNum) 'Return Cell value from the given row and column
' End If
' If x=1 Then
' objWorkBook.Close 'Deallocate the excel object
' Set objWorkBook =Nothing
' End If
' Get_Cell_Value=CellValue
'
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns the column name of a given extract for the given column index
'#Input Parameters: Extract location/Excel Object and column index
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Get_Column_Name(vFileName,objWorkSheet,Col)
' CellValue=0
' iColNum=0
' If trim(vFileName) <> "" Then
' Set objExcel = CreateObject("Excel.Application") 'Create an Excel object
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' x=1
' End If
' ColCount = objWorkSheet.UsedRange.columns.count+5 'Get Columns from the Excel file
' If ColCount < Col Then
' ColName=objWorkSheet.Cells(1,cint(Col))
' If IsNull(ColName) Then
' Get_Column_Name = "Blank Column Name"
' Else
' Get_Column_Name=ColName
' End If
' Else
' Get_Column_Name="Given Column Index is out of range"
' End If
' If x=1 Then
' objWorkBook.Close 'Deallocate the excel object
' Set objWorkBook =Nothing
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to save to Excel
'#Input Parameters::
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function Save_To_Excel(vWorkBook,vWorkSheet)
' Dim ObjExcel
' Dim ObjWorkBook
' Dim ObjWorksheet
' Dim vRow, vRow_Count, vCol_Index, vWorkSheet_index, vWorkSheet_Exists
' Dim Folder_Path_arr, vFolder_Path, vArray_Size
' Call Close_All_Excel_Files()
' ' Create the folder in the specified path if not exist
' Folder_Path_arr = Split(vWorkBook, "\")
' vFolder_Path = Folder_Path_arr(0)
' For vArray_Size = 1 To UBound(Folder_Path_arr) - 1
' vFolder_Path = vFolder_Path & "\"&Folder_Path_arr(vArray_Size)
' If Not Check_Folder_Exists(vFolder_Path) Then
' Create_Folder(vFolder_Path)
' End If
' Next
' Set ObjExcel = CreateObject("Excel.Application")
' If Check_File_Exists(vWorkBook) = False Then
' Set ObjWorkBook = ObjExcel.Workbooks.Add
' Set ObjWorksheet = ObjWorkBook.Sheets.Item(1)
' ObjWorkBook.Worksheets.Add.Name = vWorkSheet
' ObjWorkBook.SaveAs(vWorkBook)
' Save_To_Excel=True
' Else
' Set ObjWorkBook = ObjExcel.Workbooks.Open(vWorkBook)
' If Check_WorkSheet_Exists(ObjWorkbook,vWorkSheet) Then
' ObjExcel.DisplayAlerts = False
' ObjExcel.Worksheets(vWorkSheet).Delete
' ObjExcel.DisplayAlerts = True
' End If
' ObjExcel.Worksheets.Add.Name = vWorkSheet
' ObjWorkBook.Save
' Save_To_Excel=True
' End If
' Set ObjWorksheet = objWorkBook.Worksheets(vWorkSheet)
' ObjWorksheet.Activate
' ObjWorksheet.Paste
' ObjWorkBook.Save
' ObjWorkBook.Close True
' Set ObjWorksheet = Nothing
' Set ObjWorkBook = Nothing
' Set ObjExcel = Nothing
'End Function
'########################################################################################################################################################################
'#Function Description: The function is a generic fucntion is used to save to Excel
'#Input Parameters::
'#Return Values: True/Error message
'#######################################################################################################################################################################
'Public Function SaveButton_To_Excel(vWorkBook)
' Dim Folder_Path_arr, vFolder_Path, vArray_Size
' 'Call Close_All_Excel_Files()
' ' Create the folder in the specified path if not exist
' Folder_Path_arr = Split(vWorkBook, "\")
' vFolder_Path = Folder_Path_arr(0)
' For vArray_Size = 1 To UBound(Folder_Path_arr) - 1
' vFolder_Path = vFolder_Path & "\"&Folder_Path_arr(vArray_Size)
' If Not Check_Folder_Exists(vFolder_Path) Then
' Create_Folder(vFolder_Path)
' End If
' Next
' If Window("Microsoft Excel").Exist(10) Then
' Window("Microsoft Excel").Type micAltDwn + "f" + micAltUp
' Window("Microsoft Excel").Type "a"
' Window("Microsoft Excel").Window("Save As").Winobject("Filename").Type vWorkBook
' wait(2)
' Window("Microsoft Excel").Window("Save As").Click 548,320
' If Window("Microsoft Excel").Window("Save As").Dialog("Microsoft Excel").Exist(3) Then 'This is to replace the existing file with the same name
' Window("Microsoft Excel").Window("Save As").Dialog("Microsoft Excel").Winbutton("Yes").Click
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("Yes").Click
' End If
' End If
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("Yes").Click
' End If
' wait(2)
' Window("Microsoft Excel").Type micAltDwn + "f" + micAltUp
' Window("Microsoft Excel").Type "x"
' If Window("Microsoft Excel").Dialog("Microsoft Excel").Exist(3) Then
' Window("Microsoft Excel").Dialog("Microsoft Excel").Winbutton("No").Click
' End If
' SaveButton_To_Excel=True
' Else
' SaveButton_To_Excel= "Unable to Find the Microsoft Excel Window to save worksheet "&vWorkBook
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function terminates all the active windows excel processes
'#Input Parameters:None
'#Return Values: None
'#######################################################################################################################################################################
'Public Function Close_All_Excel_Files()
' wait(2)
' strComputer = "."
' Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
' Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'Excel.exe'") 'Capture the active windows Excel Processes
' If colProcesses.Count > 0 Then
' For Each objProcess in colProcesses 'Terminate Excel Processes one by One
' objProcess.Terminate()
' wait(1)
' Next
' End If
'End Function
'Public Function Check_Folder_Exists(vFolder)
' Dim ObjFSO
' Set ObjFSO= CreateObject("Scripting.FileSystemObject")
' If (ObjFSO.FolderExists(vFolder)) Then
' Check_Folder_Exists = True
' Else
' Check_Folder_Exists = False
' End If
' Set ObjFSO = Nothing
'End Function
'
'Public Function Create_Folder(vFolder)
' Dim ObjFSO, ObjFldr
' Set ObjFSO = CreateObject("Scripting.FileSystemObject")
' Set ObjFldr = ObjFSO.CreateFolder(vFolder)
' Create_Folder = ObjFldr.Path
' Set ObjFSO = Nothing
'End Function
'
'Public Function Check_WorkSheet_Exists(ObjWorkbook,vWorkSheet)
' Dim vWorkSheet_index
' For vWorkSheet_index = 1 To ObjWorkBook.Sheets.Count
' If UCase(ObjWorkBook.WorkSheets(vWorkSheet_index).Name) = UCase(vWorkSheet) Then
' Check_WorkSheet_Exists = True
' Exit For
' Else
' Check_WorkSheet_Exists = False
' End If
' Next
'End Function
'
'Public Function Check_File_Exists(vFileName)
' Dim ObjFSO
' Set ObjFSO = CreateObject("Scripting.FileSystemObject")
' If (ObjFSO.FileExists(vFileName)) Then
' Check_File_Exists = True
' Else
' Check_File_Exists = False
' End If
' Set ObjFSO = Nothing
'End Function
'########################################################################################################################################################################
'#Function Description: The function verifies whether the given column is existing in the excel sheet
'#Input Parameters:Excel file Name, Excel sheet name, column Name and Value to be searched in the column
'#Return Values: True/Error message based on execution status
'#######################################################################################################################################################################
'Public Function Read_Exported_View(sFileName,vSheet,sFieldName,Val)
' Dim ObjFSO,ObjExcel,ObjWorkBook,ObjWorkSheet,OSearchRegion,OSearchResult
' Dim iColNum
' iColNum=0
' Set ObjFSO=CreateObject("Scripting.FileSystemObject")
' If ObjFSO.FileExists(sFileName) Then
' Set ObjExcel = CreateObject("Excel.Application") 'Create Excel Object
' Set ObjWorkBook = objExcel.Workbooks.Open (sFileName)
' Set ObjWorkSheet = objWorkBook.WorkSheets(vSheet)
' ColCount = ObjWorkSheet.UsedRange.columns.count+5 'Capture the number of columns
' Row_Count = ObjWorkSheet.UsedRange.Rows.count 'Capture the number of rows
' Set OSearchRegion = ObjWorkSheet.Range(ObjWorkSheet.cells(1,1),ObjWorkSheet.cells(1, ColCount ))
' notfound = ""
' Set OSearchResult = OSearchRegion.Find(sFieldName) 'Search for a given column name
' If not OSearchResult is nothing then
' iColNum = OSearchResult.column
' If trim(Val) <> "" Then
' Read_Exported_View="Failed to find the required text from the exported view"
' For i=2 to Row_Count
' temp_val = ObjWorkSheet.Rows(i).Columns(iColNum).Value 'Search for a given Value
' If trim(temp_val) = trim(Val) Then
' Read_Exported_View=True
' Exit For
' End If
' Next
' Else
' Read_Exported_View=True
' End If
' Else
' Read_Exported_View="Column Not found"
' End If
' ObjWorkBook.Close
' Set ObjWorkBook =Nothing
' Else
' Read_Exported_View=sFileName&" File not found "
' End If
'End Function
'########################################################################################################################################################################
'#Function Description: The function returns the number of used rows of a specified excel workbook and worksheet or returns number of used rows from a given excel object
'#Input Parameters:Excel file Name, Excel sheet name, Excel object
'#Return Values: Used row count
'#######################################################################################################################################################################
'Public Function Get_Exported_View_Row_Count(vFileName,vSheet,objWorkSheet)
' CellValue=0
' iColNum=0
' Set FSO=CreateObject("Scripting.FileSystemObject")
' If FSO.FileExists(vFileName) Then
'' If trim(vFileName) <> "" and trim(vSheet) <> "" Then 'Check for null values of excel file and sheet
' If trim(vFileName) <> "" Then 'Check for null values of excel file and sheet
' Set objExcel = CreateObject("Excel.Application")
' Set objWorkBook = objExcel.Workbooks.Open (vFileName)
' If trim(vSheet) <> "" Then
' Set objWorkSheet = objWorkBook.WorkSheets(vSheet)
' Else
' Set objWorkSheet = objWorkBook.WorkSheets(1)
' End If
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Returns number of rows from the given excel file and sheet
' objWorkBook.Close
' Set objWorkBook =Nothing
' ElseIf not objWorkSheet is Nothing Then 'Check for the null excel excel object
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Return number of used rows from the given excel object
' Set objWorkSheet = Nothing
' Else
' Get_Exported_View_Row_Count =0
' End If
' ElseIf not objWorkSheet is Nothing Then
' Get_Exported_View_Row_Count = objWorkSheet.UsedRange.Rows.count 'Return number of used rows from the given excel object
' Set objWorkSheet = Nothing
' Else
' Reporter.ReportEvent micFail, "Find Exported View or Object",vFileName&" File not found or null Object"
' End If
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Rowno(Local_Sheet, Verify_Field, Verify_Field_Val, Row_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' TotLoc_Row = Loc_Range.Rows.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Ucase(Trim(Loc_xl.Application.Cells(1,J))) = trim(UCase(Verify_Field)) Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' Row_no = 0
' If Loc_colno <>0 Then
' For Loc_Row = 1 to TotLoc_Row - 1
' Loc_val = Loc_xl.Application.Cells(Loc_Row+1,Loc_colno)
' 'The issue is with Date column on CSV. Date by default gets converted to MM/DD/YY
' If UCase(Right(Local_Sheet, 3)) = "CSV" Then
' If Isdate(Loc_val) Then
' Loc_val = cstr(DATEVALUE(MID(Loc_val,4,2)&"/"&LEFT(Loc_val,2)&"/"&RIGHT(Loc_val,2)))
' End If
' End If
' If Ucase(Trim(Loc_val)) =Ucase(Trim(Verify_Field_val)) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' Get_Table_Rowno = Row_no
' End If
' Next
' Else
' Row_no = 0
' End If
' Get_Table_Rowno = Row_no
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Columnno(Local_Sheet, Verify_Field, Col_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range = Loc_Sht.UsedRange
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If UCase(Trim(Loc_xl.Application.Cells(1,J))) =UCase(Verify_Field) Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' If Loc_colno <>0 Then
' Col_no = Loc_colno
' Else
' Col_no = 0
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Verify the Specific Import Trade Values on Enquiry Screen after the Commit
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Columnval(Local_Sheet, Verify_Field, Record_Number, Col_val)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' If Loc_colno <>0 Then
' Col_val = Loc_xl.Application.Cells(Record_Number+1, Loc_colno) '+1 to skip the header
' 'The issue is with Date column on CSV. Date by default gets converted to MM/DD/YY
' If UCase(Right(Local_Sheet, 3)) = "CSV" Then
' If Isdate(Loc_val) Then
' Loc_val = cstr(DATEVALUE(MID(Loc_val,4,2)&"/"&LEFT(Loc_val,2)&"/"&RIGHT(Loc_val,2)))
' End If
' End If
' Else
' Col_val =""
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Get the number of Table Row Count
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_FieldValueCount(Local_Sheet, Verify_Field, Field_Value, Field_Count)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_colno = 0
'
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' Loc_xl.DisplayAlerts = False
'
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field Then
' Loc_colno = J
' J = TotLoc_Col + 1
' End If
' Next
' Field_Count = 0
' If Loc_colno <>0 Then
' While (Loc_xl.Application.Cells(Loc_Row+1,1).Value) <> ""
' If Field_Value = Loc_xl.Application.Cells(Loc_Row+1, Loc_colno) Then '+1 to skip the header
' Field_Count = Field_Count + 1
' End If
' Loc_Row = Loc_Row + 1
' Wend
' End If
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = Nothing
'End Function
'#################################################################################################################################
'#Function Description: Get the value of the table specified for multi column values
'#Input Parameters: Local Sheet Location and Field to be Verified
'#Return Values: True
'#################################################################################################################################
'Public Function Get_Table_Rowno_Multi(Local_Sheet, Verify_Field, Verify_Field_Val, Row_no)
' 'Close_Float_Excel()
' Set Loc_xl = CreateObject("Excel.Application")
' Loc_xl.Application.Workbooks.Open(Local_Sheet)
'
' Loc_Row = 1
' Loc_column = ""
' 'Get the number of columns on the Local Sheet
' Set Loc_Sht = Loc_xl.Sheets(1)
' Set Loc_Range =Loc_Sht.Range("A1").CurrentRegion
' TotLoc_Col = Loc_Range.Columns.Count
' TotLoc_Row = Loc_Range.Rows.Count
' Loc_xl.DisplayAlerts = False
' Verify_field_arr = Split(Verify_Field, ":", -1, 1)
' For I = 0 to UBound(Verify_field_arr)
' For J = 1 to TotLoc_Col
' If Trim(Loc_xl.Application.Cells(1,J)) = Verify_Field_arr(I) Then
' Loc_column = Loc_column & J & ":"
' J = TotLoc_Col + 1
' End If
' Next
' Next
' Row_no = 0
' If Loc_column <> "" Then
' For Loc_Row = 1 to TotLoc_Row - 1
' Loc_val = ""
' Local_Column_arr = Split(Loc_column,":", -1, 1)
' For I = 0 to UBound(Local_Column_arr)
' If Local_Column_arr(I) <> "" Then
' Loc_val = Loc_val & Loc_xl.Application.Cells(Loc_Row+1,int(Local_Column_arr(I)))
' End If
' Next
' If isnumeric(Loc_val) Then
' If int(Loc_val) =int(Verify_Field_val) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' End If
' Else
' If Trim(Loc_val) =Trim(Verify_Field_val) Then
' Row_no = Loc_Row
' Loc_Row = TotLoc_Row + 1
' End If
' End If
' Next
' Else
' Row_no = 0
' End If
'
' 'Close the Excel Sheet
' Loc_xl.DisplayAlerts = True
' Loc_xl.Quit
' Set Loc_xl = No