Skip to main content

Web Based Functions - II

Function GetCellData(sBrowserName, sPageName,sTableName,sRow, sCol,iTestNo)

' HELP
' method: GetCellData()
' returns: Data from a Specific Cell of the table
' parameter: sBrowserName,sPageName,sTableName,sRow,sCol
' parameter:
' notes: To retrieve Data from a Specific Cell of the table
' END
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then
GetCellData = Trim(Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetCellData(sRow, sCol))
If GetCellData <> "" Then
Call GenerateTestStatus(iTestNo, FCR_PASS,"Get CellData from WebTable", "Web Table '" & CStr(sTableName) & "' Value is ::" & CStr(GetCellData) & ".")

Else
Call GenerateTestStatus(iTestNo, FCR_WARNING, "Get CellData from WebTable", "Web Table '" & CStr(sTableName) & "' Value is Empty from Cell ::" & CStr(sRow) & "," & CStr(sCol) & ".")

End If
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Get CellData from WebTable", "Web Table '" & CStr(sTableName) & "' No Table Found in Page.")

End If
End Function


Sub OperateTableWebEdit(sBrowserName, sPageName, sTableName, sRow, sCol, iVal,iTestNo)

' HELP
' method: OperateTableCheckBox(sBrowserName,sPageName,sTableName,sRow,sCol,sOperation)
' returns:
' parameter: sRow,sCol : Row &Col to Select/Deselect any Check Box of a Table
' parameter:
' notes: To Enter Data for a Web Edit found from a Specific Cell of the table

' END

Dim SetWebEdit
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then

sWebEditexist = Trim(Browser(sBrowserName).Page(sPageName).WebTable(sTableName).ChildItemCount(sRow, sCol, "WebEdit"))
If sWebEditexist = 1 Then
Set SetWebEdit = Browser(sBrowserName).Page(sPageName).WebTable(sTableName).ChildItem(sRow, sCol, "WebEdit", 0)
SetWebEdit.Set iVal
Reporter.ReportEvent MicPass, "Web Table : " & CStr(sTableName), " Radio Button in Row :" & CStr(sRow) & ":: of Column" & CStr(sCol) & " is set as " & CStr(iVal)
Else
Reporter.ReportEvent MicFail, "Web Table :" & CStr(sTableName), " not Found in given Page :" & CStr(sPageName)

End If

sWebEditContent = SetWebEdit.GetROProperty("value")

If (Trim(sWebEditContent) = Trim(iVal)) Then
Call GenerateTestStatus(iTestNo, FCR_PASS, "Operate Web Edit in Table ", "Web Edit '" & SetWebEdit & "' Value from Application is '" & CStr(sWebEditContent) & "' is edited Sucessfully.")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Operate Web Edit in Table ", "Web Edit '" & SetWebEdit & "' Value from Application is '" & CStr(sWebEditContent) & "' is not edited Sucessfully.")

End If
Else
Call GenerateTestStatus(iTestNo, FCR_WARNING, "Operate Web Edit in Table ", "Web Edit '" & SetWebEdit & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is not found .")
End If



End Sub




'CHK$$
Sub FrameImageClick(sBrowserName, sPageName, sFrame, sImgName,iTestNo)

' HELP
' method: FrameImageClick
' returns: None
' parameter: sImgName
' notes: This will clicks on the given image link in the Frame/page/application.
' END

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).frame("name:=" & sFrame).Image("name:=" & sImgName, "html tag:=IMG").Exist Then
Browser(sBrowserName).Page(sPageName).frame("name:=" & sFrame).Image("name:=" & sImgName, "html tag:=IMG").Click
Call GenerateTestStatus(iTestNo, FCR_PASS, "Frame Image Click", "Image '" & sImgName & "' is Clicked Sucessfully.")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Frame Image Click", "Image '" & sImgName & "' is not found")
End If

End Sub
'CHK$$
Sub SelectFrameRadioButton(sBrowserName, sPageName, sFrame, sName, iOption,iTestNo)

' HELP
' method: SelectFrameRadioButton
' returns: None
' parameter: sFrame.
' notes: It will selects radio button in a Frame
' END

Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).frame("name:=" & sFrame).WebRadioGroup("html tag:=INPUT", "name:=" & sName).Exist Then
Browser(sBrowserName).Page(sPageName).frame("name:=" & sFrame).WebRadioGroup("html tag:=INPUT", "name:=" & sName).Select iOption
Reporter.ReportEvent MicPass, "Select Radio Button in Frame", sName & "is exist and option is selected."
Else
Reporter.ReportEvent MicFail, "Select Radio Button in Frame", sName & "not exists and option not selected."
End If
Browser(sBrowserName).Page(sPageName).sync
End Sub


Sub VerifyTextIsNotPresent(sBrowserName, sPageName, sTableName, sExpTitle,iTestNo)

' HELP
' method: VerifyTextIsNotPresent(sBrowserName,sPageName,sTableName,sActualTitle)
' returns: Returns Title/caption of the Page
' parameter: sBrowserName sTableName: Name of Table
' parameter: sActualTitle: Title of the page under testing
' notes: Verifies the Expected title of the Page
' END

Dim oDesc
Dim sTitle

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then
stext = Trim(Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetROProperty("innertext"))
If InStr(stext, sExpTitle) = 0 Then
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify Text ", "Expected Text '" & sExpTitle & "' is not displayed on the page.")
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify Text ", "Expected Text '" & sExpTitle & "' is displayed on the page.")
End If
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify Text ", "Web Table '" & sTableName & "' doesn't exist.")
End If

End Sub



Sub GetRowCount(sBrowserName, sPageName, sTableName,iTestNo)
' HELP
' method: GetRowCount ()
' returns: Return Specific Table Row count
' parameter: sTableName : Name of the Table in that perticualr Page and Browser
' notes: This is used to get number of rows in the Table
' END

Dim iRows

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then
iRows = Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetROProperty("rows")
GetRowCount = iRows
Call GenerateTestStatus(iTestNo, FCR_PASS, "Get Row Count ", "WebTable '" & sTableName & "' has " & "No. of Rows " & CStr(iRows) & ".")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Get Row Count ", "WebTable '" & sTableName & "' doesn't Exists.")

End If

End Sub


Sub VerifyValueNotFoundInWebList(sBrowserName, sPageName, sListName, sValue,iTestNo)

' HELP
' method: VerifyValueNotFoundInWebList ()
' returns: Pass If not Found
' parameter: sListName : Name of the List Object
' parameter: sValue : Value Should not exist in the List
' notes: This is used to Verify Value Should not exist in the List
' END

Dim sListValue

sListValue = GetWebListItems(sBrowserName, sPageName, sWebListName,iTestNo)

If InStr(sListValue, sValue) <> 0 Then
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify Value Not Found In WebList", "WebList '" & CStr(sWebListName) & "' Value '" & CStr(sListValue) & "' is found.")


Else
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify Value Not Found In WebList", "WebList '" & CStr(sWebListName) & "' Value '" & CStr(sListValue) & "' is not found.")

End If


End Sub

'CHK$$
Sub SelectDifferentListValue(sBrowserName, sPageName, sWebListName,iTestNo)
' HELP
' method: SelectDifferentListValue (sBrowserName,sPageName,sListName)
' returns: Selects Different Value from the List
' parameter: sListName : Name of the List Object
' notes: This is used to Select Different Value from the list object
' END

Dim iSelIndex, iCount, sListValue


If Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Exist Then
iSelIndex = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Object.selectedIndex
iCount = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetROProperty("items count")

If (iSelIndex = 0) Then
iSelIndex = iSelIndex + 1
ElseIf (iSelIndex = (iCount - 1)) Then
iSelIndex = iSelIndex - 1
Else
iSelIndex = iSelIndex + 1
End If
iSelIndex = iSelIndex + 1
sListValue = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetItem(iSelIndex)
Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Select sListValue

Call GenerateTestStatus(iTestNo, FCR_PASS, "Select Different List Value", "WebList '" & CStr(sWebListName) & "' Value '" & CStr(sListValue) & "' is selected.")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Select Different List Value", "WebList '" & CStr(sWebListName) & "' does not exists.")

End If
End Sub




Sub VerifyCellData(sBrowserName, sPageName, sTableName, sRow, sCol, sData,iTestNo)

' HELP
' method: VerifyCellData()
' returns: None
' parameter: sBrowserName,sPageName,sTableName,sRow,sCol
' parameter:
' notes: To verify the Specific cell data does not matched with expected cell having it row and col as parameters
' END

Dim sCellData
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then
sCellData = Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetCellData(sRow,sCol)
'msgbox Trim(sCellData)&"is Matched with"& Trim(sData)
If strcomp(Trim(cstr(sCellData)),Trim(cstr(sData)))= 0 Then
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify CellData in WebTable", "Web Table '" & CStr(sTableName) & "' Value '" & CStr(sCellData) & "' is matched with Expected value '" & sData & "'.")
'Reporter.ReportEvent MicFail, "Verify Cell Data", "Expected data not existed in the Cell Expected Value of the Cell is : " & CStr(sData)
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify CellData in WebTable", "Web Table '" & CStr(sTableName) & "' Value '" & CStr(sCellData) & "' is not matched with Expected value '" & sData & "'.")
'Reporter.ReportEvent MicPass, "Verify Cell Data Expected" & CStr(sTableName), " Data is existed "
End If
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify CellData in WebTable", "Web Table '" & CStr(sTableName) & "' table is not found.")

End If

End Sub


Sub VerifyCellDataNotPresent(sBrowserName, sPageName, sTableName, sRow, sCol,iTestNo)

' HELP
' method Used: GetCellData()
' method : VerifyCellDataNotPresent()
' returns: None
' parameter: sBrowserName,sPageName,sTableName,sRow,sCol
' parameter:
' notes: To verify the Specific cell data does not matched with expected cell having it row and col as parameters
' END
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then
VerifyCellDataNotPresent = Trim(Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetCellData(sRow, sCol))
If VerifyCellDataNotPresent <> "" Then
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify CellData in WebTable", "Web Table '" & CStr(sTableName) & "' Value '" & CStr(GetCellData) & "' is not matched with Expected value '" & sData & "'.")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify CellData not present in WebTable", "Web Table '" & CStr(sTableName) & "' Value '" & CStr(GetCellData) & "' is matched with Expected value '" & sData & "'.")
Reporter.ReportEvent MicPass, "Data from Web Table::" & CStr(sTableName), "Value is Empty from Cell ::" & CStr(sRow) & "," & CStr(sCol)
End If
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify CellData not present in WebTable", "Web Table '" & CStr(sTableName) & "' table is not found.")
Reporter.ReportEvent MicFail, "Data from Web Table :: " & CStr(sTableName), "No Table Found in Page."
End If
End Sub



Function CountCheckBoxInPage(sBrowserName, sPageName, sTreeName, iChkNum,iTestNo)

'notes: toCount and Select On for check Boxes in page with in the Limit

Dim arrCheckBox
Dim iCnt

Set arrCheckBox = Browser(sBrowserName).Page(sPageName).Object.all.tags("INPUT")
For Each Element In arrCheckBox
If Element.getAttribute("Type") = "checkbox" And Element.getAttribute("Name") = Trim(sChkName) Then
iCnt = iCnt + 1
End If
Next
If Not iChkNum > iCnt Then
Browser(sBrowserName).Page(sBrowserName).WebCheckBox("name:=" & sChkName, "index:=" & iChkNum).Set "ON"
Call GenerateTestStatus(iTestNo, FCR_PASS, "Set Multiple Check Boxes", "Check Box '" & sChkName & "' has made set 'ON' .")
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Set Multiple Check Boxes", "Check Boxes count '" & iChkNum & "' is exceeding the range .")
End If

End Function


Sub ClickJLButton(sBrowserName, sPageName, sButton_Name,iTestNo)

' HELP
' method: ClickButton
' returns: None
' parameter: sType,sButton_Name,iIndx
' notes: It will clicks on the given button in the page/application.Button should be in OR
' END


If Browser(sBrowserName).Page(sPageName).WebButton(sButton_Name).Exist Then
'msgbox "Exists"
Browser(sBrowserName).Page(sPageName).WebButton(sButton_Name).Click
Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the button", " Name ' " & sButton_Name & "' found and clicked Sucessfully." )

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the button", " Name ' " & sButton_Name & "' not found to click." )

End If

End Sub
Sub ClickHtmlIDButton(sBrowserName, sPageName, sButton_Name,sHtmlID,iTestNo)

' HELP
' method: ClickButton
' returns: None
' parameter: sType,sButton_Name,HtmlID
' notes: It will clicks on the given button in the page/application.Pass HtmlID for the button
' END

Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebButton("html tag:=BUTTON","html id:= "&sHtmlID, "name:=" & sButton_Name, "type:=button").Exist Then

Browser(sBrowserName).Page(sPageName).WebButton("html tag:=BUTTON","html id:= "&sHtmlID, "name:=" & sButton_Name, "type:=button").Click
Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the button", " Name ' " & sButton_Name & "' found and clicked Sucessfully." )

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the button", " Name ' " & sButton_Name & "' not found to click." )

End If

End Sub

Sub ClickDIVWebElement(sBrowserName,sPageName,sWebElement_Name,iIndex,iTestNo) 'Check it once

' HELP
' method: ClickWebElement
' returns: None
' parameter: sWebElement_Name Name of the Web Element to Click
' notes: It will Clicks on the given WebElement in the page/application.
' END

Browser(sBrowserName).Page(sPageName).sync
'Browser(sBrowserName).Page(sPageName).WebElement("html tag:=DIV", "innertext:=" & sWebElement_Name,"index:= "&iIndex).highlight
' msgbox Browser(sBrowserName).Page(sPageName).WebElement("html tag:=DIV", "innertext:=" & sWebElement_Name,"index:= "&iIndex).Exist

If Browser(sBrowserName).Page(sPageName).WebElement("html tag:=DIV", "innertext:=" & sWebElement_Name,"index:= "&iIndex).Exist Then
Browser(sBrowserName).Page(sPageName).WebElement("html tag:=DIV", "innertext:=" & sWebElement_Name,"index:= "&iIndex).Click
Call GenerateTestStatus (iTestNo,FCR_PASS," Click on WebElement ","Name '" &sWebElement_Name &"' WebElement is clicked Sucessfully.")

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Click on WebElement ","Name '" &sWebElement_Name &"' not found to click.")

End If


End Sub

Sub ClickTableGenLink_OR(sBrowserName, sPageName, sTableName, sRow, sCol,iTestNo)

' HELP
' method: ClickTableLink()
' returns:
' parameter: sRow,sCol : Row &Col ,sInnertext
' parameter:
' notes: To CLick the Link in the Table. Table should be under OR.
' END
Dim SetLink
Browser(sBrowserName).Page(sPageName).sync



If Browser(sBrowserName).Page(sPageName).WebTable(sTableName).Exist Then


bLinkexist = Trim(Browser(sBrowserName).Page(sPageName).WebTable(sTableName).ChildItemCount(sRow,sCol,"Link"))
'msgbox Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetCellData(sRow, sCol)

'msgbox "Link Exist:"&bLinkexist

Set SetLink = Browser(sBrowserName).Page(sPageName).WebTable(sTableName).ChildItem(sRow, sCol,"Link",0)

SetLink.Click

SetLinkName = Browser(sBrowserName).Page(sPageName).WebTable(sTableName).GetCellData(sRow, sCol)

Call GenerateTestStatus(iTestNo, FCR_PASS, "Click Link in a Table ", "Link '" & SetLinkName & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is clicked Successfully .")

Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Click Link in a Table ", "Web Table '" & CStr(sTableName) & "' not found in a given Page :" & CStr(sPageName) & ".")

End If
End Sub


Function SelectData_OR(sBrowserName, sPageName, sListName, sValue, iTestNo)


' HELP
' method: SelectData
' returns: None
' parameter: sListName,sValue
' notes: This will selects given value from the given list box
' END

Dim stext, bListItemFound, sDisplayedListItems, iItem, iItemsCount

bListItemFound = False


Browser(sBrowserName).Page(sPageName).sync

'check for the required weblist
If Browser(sBrowserName).Page(sPageName).WebList(sListName).Exist Then
'check whether the weblist is in enabled state
If Browser(sBrowserName).Page(sPageName).WebList(sListName).GetROProperty("disabled") = FCR_ZERO Then
'retrieve the items from the list
iItemsCount = Browser(sBrowserName).Page(sPageName).WebList(sListName).GetROProperty("items count")

'in the list
For iItem = 1 To iItemsCount
'get the list item present at iItem position
stext = Browser(sBrowserName).Page(sPageName).WebList(sListName).GetItem(iItem)
'stext1=UCase(Replace(stext," ",""))
'compare the value from the list with that of the user required
If Trim(stext) = Trim(sValue) Then
'select the required item
Browser(sBrowserName).Page(sPageName).WebList(sListName).Select stext
'make necessary report event
Call GenerateTestStatus(iTestNo, FCR_PASS, "Select data from ComboList", " Name '" & sListName & "' exist and '" & sValue & "' data is selected successfully.")

bListItemFound = True
Exit For
End If
Next
Else 'if weblist is in disabled state

Call GenerateTestStatus(iTestNo, FCR_FAIL, "Select data from ComboList", " Name '" & sListName & "' is not enabled to select.")
Exit Function
End If 'check for the weblist state

'if required item is not found in the list
If Not bListItemFound Then

sDisplayedListItems = Browser(sBrowserName).Page(sPageName).WebList(sListName).GetROProperty("all items")
'display available list items
Call GenerateTestStatus(iTestNo, FCR_DONE, "Select data from ComboList", "Items in the list '" & sListName & "' are '" & sDisplayedListItems & "'")

'make necessary report event
Call GenerateTestStatus(TestCase_ID, FCR_FAIL, "Select data from ComboList", "Combo List '" & sListName & "' exist and '" & sValue & "' is not available to select ")
End If 'check for the existence of the list item

Else 'if the list is not available
'make necessary report event
Call GenerateTestStatus(TestCase_ID, FCR_FAIL, "Select data from ComboList", "Combo List '" & sListName & "' doesn't exist to select '" & sValue & "'")

End If 'check for the weblist existence in the application


End Function



'**************** Added on 21 Aug ****************************

Sub InputDate( sBrowserName,sPageName,sExpDate,iTestNo)

Dim iYrDiff,iMonDiff,sDateLinkName

iYrDiff = Year(Now) - Year(sExpDate)
iMonDiff =Month (Now) - Month(sExpDate)
sDateLinkName = day(sExpDate)
'iIndex = FCR_NULL
'msgbox Browser(sBrowserName).Page(sPageName).Exist
'msgbox Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_IMG,"html tag:=IMG","html id:="&sImgHtmlId,"index:=" & iIndex).exist

'Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_IMG,"html tag:=IMG","html id:="&sImgHtmlId,"index:=" & iIndex).highlight

If Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_IMG,"html tag:=IMG","html id:="&sImgHtmlId,"index:=" & iIndex).Exist Then
Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_IMG,"html tag:=IMG","html id:="&sImgHtmlId,"index:=" & iIndex).Click

Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the Image ", " Name ' " & sImgFileName & "' and clicked successfully." )


Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the Image ", " Name ' " & sImgFileName & "' not found to click." )


End If
'Call ImageClick_NOR(sBrowserName,sPageName,sImgFileName,iTestNo)
'Call ImageClick(sBrowserName,sPageName,FCR_TB_PRMPT_CALENDR_IMG,FCR_NULL,iTestNo)
'Browser(sBrowserName).Page(sPageName).Image("file name:=calendar.jpg " , "html tag:=IMG").Click
If iYrDiff > FCR_ZERO Then
For iYrCntr = 1 to iYrDiff
'Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_PREVYR_IMG , "html tag:=IMG", "index:="&iIndex).Click
Call ImageClick(sBrowserName,sPageName,FCR_TB_PRMPT_CALENDR_PREVYR_IMG,FCR_NULL,iTestNo)
Next
End if
if iYrDiff < FCR_ZERO then
For iCntr = 1 to abs( iYrDiff)
'Browser(sBrowserName).Page(sPageName).Image("file name:=nextyear.gif" , "html tag:=IMG", "index:="&iIndex).Click
Call ImageClick(sBrowserName,sPageName, FCR_TB_PRMPT_CALENDR_NXTYR_IMG, FCR_NULL,iTestNo)
Next
End if
If iMonDiff > FCR_ZERO Then
For iMonCntr = 1 to iMonDiff
'Browser(sBrowserName).Page(sPageName).Image("file name:="&FCR_TB_PRMPT_CALENDR_PREVMON_IMG , "html tag:=IMG", "index:=").Click
Call ImageClick(sBrowserName,sPageName,FCR_TB_PRMPT_CALENDR_PREVMON_IMG, FCR_NULL,iTestNo)
Next
End if
if iMonDiff < FCR_ZERO then
For iCntr = 1 to abs( iMonDiff)

'Msgbox Browser(sBrowserName).Page(sPageName).Image("file name:=nextmonth.gif","html tag:=IMG", "index:=").Exist
'Browser(sBrowserName).Page(sPageName).Image("file name:=nextmonth.gif","html tag:=IMG", "index:=").Click
Call ImageClick(sBrowserName,sPageName, FCR_TB_PRMPT_CALENDR_NXTMON_IMG,FCR_NULL,iTestNo)
Next
End if
'Browser(sBrowserName).Page(sPageName).Link("html tag:=A", index:=","name:=" &sDateLinkName).Click
Call ClickLink(sBrowserName,sPageName, FCR_NULL, sDateLinkName,FCR_NULL,iTestNo)


End Sub

Function NodeStatus(sBrowserName, sPageName,sHtmlId,iIndex,iTestNo)

' HELP
' method: NodeStatus
' returns: None
' parameter: sImgFileName,sHtmlId iIndex
' notes: This will return the value for property of image file name in the page/application.
'Probably used most of the time as a preCheck for ImageHtmlIdClick
' END

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).Image("html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).Exist Then
'Browser(sBrowserName).Page(sPageName).Image("html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).highlight

sImgFileName =Browser(sBrowserName).Page(sPageName).Image("html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).GetRoProperty("file name")
Call GenerateTestStatus (iTestNo,FCR_DONE, "Get Node Status ", " Name ' " & sImgFileName & "'is Exists." )


Else
Call GenerateTestStatus (iTestNo,FCR_WARNING, "Get Node Status ", " Name ' " & sImgFileName & "' is not Exists" )


End If
NodeStatus = sImgFileName
'Msgbox sImgFileName

End Function



Sub ImageHtmlIdClick(sBrowserName, sPageName, sImgFileName,sHtmlId,iTestNo)

' HELP
' method: ImageHtmlIdClick
' returns: None
' parameter: sImgFileName,sHtmlId iIndex
' notes: This will clicks on the given image link in the page/application.
' END

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).Image("file name:= " & sImgFileName, "html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).Exist Then
Browser(sBrowserName).Page(sPageName).Image("file name:= " & sImgFileName, "html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).Highlight
Browser(sBrowserName).Page(sPageName).Image("file name:= " & sImgFileName, "html tag:=IMG", "html id:=" & sHtmlId,"index:="&iIndex).click

Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the Image ", " Name ' " & sImgFileName & "' and clicked successfully." )


Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the Image ", " Name ' " & sImgFileName & "' not found to click." )


End If

End Sub


Sub ObjectExists_HtmlID(sBrowserName, sPageName, sButton_Name,sHtmlID,sObjectType,iTestNo)


' HELP
' method: ObjectExists_HtmlIDButton()
' returns: None
' parameter: sObjectName: Name of the object which to be verified.
' parameter: sObjectType: Type of the object can be verified are :-
'"WebElement","WebButton","WebEdit","WebList",'"Link","Image","WebButton","WebCheck","WebRadio"
' notes: This function verifies whether passed object as input is found or not.
' END

Dim sTitle


Select Case sObjectType


Case "WebButton":

Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).WebButton("html tag:=BUTTON","html id:= "&sHtmlID, "name:=" & sButton_Name, "type:=button","index:=" & iIndex).Exist Then
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object based on HtmlID ", "Name'" & sButton_Name & "' and type '" & sObjectType & "' is existed." )
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object based on HtmlID ", "Name'" & sButton_Name & "' and type '" & sObjectType & "' is not existed." )
End If
End Select


End Sub





Sub VerifyTextInWBElt(sBrowserName, sPageName,sWBEltName,sExpTitle,iTestNo)


' HELP
' method: VerifyTextInWBElt()
' returns: None
' parameter: sBrowserName sWBEltName: Innertext of WBElement
'(Ex: if innertext as "ActualWhole" has to be passed instead of orginal "ActualWhole Number (no decimals)"
' parameter: sExpTitle-Expected Title of the page which to be tested
' notes: Verifies the Expected Title of the page which to be tested
' END

Dim oDesc
Dim sTitle

Browser(sBrowserName).Page(sPageName).sync
'msgbox Browser(sBrowserName).Page(sPageName).Exist
'msgbox Browser(sBrowserName).Page(sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).Exist

If Browser(sBrowserName).Page(sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).Exist Then
stext = Browser(sBrowserName).Page(sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).GetROProperty("innertext")
' msgbox stext
If InStr(LCase(stext), LCase(sExpTitle)) <> 0 Then


Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify text in Page", "'"& sExpTitle & "' successfully verified on the page '"&sPageName&"'." )



Else

Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify text in Page", "'"& sExpTitle & "' doesn't exist in Page." )


End If
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify text in page", " WebElement '" & sWBEltName & "' doesn't exist." )

End If

End Sub

Sub VerifyWebListItemNotFound(sBrowserName, sPageName, sWebListName,sExpItem,iTestNo)

' HELP
' method: VerifyWebListDefaultValue(sBrowserName,sPageName,sWebListName)
' returns: None
' parameter: sWebListName as Name of the WebEdit to Verify the Default Value
' parameter: sString as Value of the WebEdit to Verify Default item
' notes: This is used to Verify Default item of a Web List in Page
' END

'Dim sExpItem

'msgbox Browser(sBrowserName).Page(sPageName).Exist
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Exist Then
sWebListState = VerifyWebListState(sBrowserName, sPageName, sWebListName,iIndex,iTestNo)

if (Trim(sWebListState) = 0) Then
iItemsCount = Browser(sBrowserName).Page(sPageName).WebList("name:=" &sWebListName,"html tag:=SELECT", "index:=" & iIndex).GetROProperty("items count")

For iItem = 1 To iItemsCount
'get the list item present at iItem position
stext = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetItem(iItem)


If StrComp(LCase(stext), LCase(sExpItem),vbTextComapre) = 0 Then

bStatus = false
Exit for
Else
bStatus = true
'Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify item value not in Web List ", "The List Items from WebList '"&sWebListName &"' doesn't contains expected item " & CStr(sExpItem)&".")
End If
Next


If bStatus Then

' Reporter.ReportEvent micPass,"Verfiy weeb list item ","The List Items from WebList '"&sWebListName &"' doesn't contains expected item " & CStr(sExpItem)&"."


Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify item value not in Web List ", "The List Items from WebList doesn't contains expected item " & CStr(sExpItem)&".")

Else
'Reporter.ReportEvent micFail, "Verfiy weeb list item ","The List Items from WebList '"&sWebListName &"' contains expected item " & CStr(sExpItem)&"."

Call GenerateTestStatus (iTestNo,FCR_FAIL,"Verify item value not in Web List", "The List Items from WebList '"&sWebListName &"' contains expected item " & CStr(sExpItem)&".")
End If
Else
'Reporter.ReportEvent micFail, "Verfiy web list item ","The List Items from WebList is in disabled state."
Call GenerateTestStatus (iTestNo,FCR_FAIL,"Verify item value not in Web List", "The WebList " & CStr(sWebListName) &" is in disabled state.")
End if
Else
'Reporter.ReportEvent micFail,"Verfiy weeb list item ","The WebList is not available."
Call GenerateTestStatus (iTestNo,FCR_FAIL,"Verify item value not in Web List ", "Name '" & CStr(sWebListName)&"'Doesn't Exists in Page.")
End If
End Sub
Sub VerifyTextInWBElt_JL(sBrowserName, sPageName,sWBEltName,sExpTitle,iTestNo)


' HELP
' method: VerifyTextInWBElt_JL()
' returns: None
' parameter: sBrowserName sWBEltName: Innertext of WBElement
'(Ex: if innertext as "ActualWhole" has to be passed instead of orginal "ActualWhole Number (no decimals)"
' parameter: sExpTitle-Expected Title of the page which to be tested
' notes: Verifies the Expected Title of the page which to be tested
' END

Dim oDesc
Dim sTitle

Browser("creationtime:=1","name:="&sBrowserName).Page("title:="&sPageName).sync
'msgbox Browser("creationtime:=1","name:="&sBrowserName).Page("title:="&sPageName).Exist
'msgbox Browser("creationtime:=1","name:="&sBrowserName).Page("title:="&sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).Exist

If Browser("creationtime:=1","name:="&sBrowserName).Page("title:="&sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).Exist Then
stext = Browser("creationtime:=1","name:="&sBrowserName).Page("title:="&sPageName).WebElement("innertext:="&sWBEltName &".*","class:="&sWBELTClass,"index:="&iIndex).GetROProperty("innertext")
' msgbox stext
If InStr(LCase(stext), LCase(sExpTitle)) <> 0 Then


Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify text in Page", "'"& sExpTitle & "' successfully verified on the page '"&sPageName&"'." )



Else

Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify text in Page", "'"& sExpTitle & "' doesn't exist in Page." )


End If
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify text in page", " WebElement '" & sWBEltName & "' doesn't exist." )

End If

End Sub

Function VerifyWebListState(sBrowserName, sPageName, sWebListName, iIndex,iTestNo)

' HELP
' method: VerifyWebListState()
' notes: This is to retrieve the Disabled Property of an Web Edit Based on Index
' parameter: sWebEditName as Name of the Web Edit ,iIndex : Number of the WEeb Edit in Page
' END

Dim sWebWebEditState
Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Exist then

sWebListState = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetROProperty("disabled")
If (Trim(sWebListState) = 0) Then


Call GenerateTestStatus (iTestNo,FCR_PASS," Check WebList State ","Name '" &sWebListName &"' is in enabled State.")

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Check WebList State ","Name '" &sWebListName &"' is in disabled State.")

End If
Else

Call GenerateTestStatus (iTestNo,FCR_FAIL," Check WebList State ","Name '" &sWebListName &"' doesn't exists.")
End If
VerifyWebListState = sWebListState
End Function

Sub VerifyChartFeildOrder(sBrowserName, sPageName,sWebTable,sRow,sCol,sFirstFeild,sSecFeild,sThirdFeild,iTestNo)

' HELP
' method: VerifyWebListState()
' notes: This is to retrieve the Disabled Property of an Web Edit Based on Index
' parameter: sWebEditName as Name of the Web Edit ,iIndex : Number of the WEeb Edit in Page
' END
ReDim sArr(4)
sArr(1) = sFirstFeild
sArr(2) = sSecFeild
sArr(3) = sThirdFeild

Dim sWebWebEditState
Browser(sBrowserName).Page(sPageName).sync
'msgbox Browser(sBrowserName).Page(sPageName).WebTable(sWebTable).Exist
If Browser(sBrowserName).Page(sPageName).WebTable(sWebTable).Exist then

sText = Browser(sBrowserName).Page(sPageName).WebTable(sWebTable).GetCellData(sRow,sCol)
'msgbox sText
sFeilds= Split(sText,"/")
'msgbox sFeilds(3)&"--"
If (Trim(sText) <> "") Then
For iChk = 1 to 3
'msgbox iChk & sFeilds(iChk)
If Strcomp(trim(LCase(sFeilds(iChk))),trim(LCase(sArr(iChk))),vbTextCompare )= 0 Then
bStatus = true
Else
bStatus = false
End if
Next

If bStatus Then
Call GenerateTestStatus (iTestNo,FCR_PASS," Verify Feild Sequence ","The sequence order for feild '"& sText & "' is matched in the Page.")
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify Feild Sequence ","The sequence order for feild '"& sText & "' is not matched in the Page.")
End If

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify Feild Sequence ","The sequence order for feild which u wanted to verify is Empty.")
End if
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify Feild Sequence ","The feild doesn't Exists in the Page.")
End if
End Sub

'CHK$$

Sub OperateTableCheckBoxNOR(sBrowserName, sPageName, sInnertext,sRow, sCol, sOperation,iTestNo)

' HELP
' method: OperateTableCheckBoxNOR
' returns: None
' parameter: sTableName,iIndex
' parameter: sRow,sCol as Row &Col to Select/Deselect any Check Box of a Table
' notes: Selection of Check box in the Specified table is option made ON/OFF .
' Notes: No need to keep in object repository
' END

Dim SetCheckBox
Browser(sBrowserName).Page(sPageName).sync
'msgbox Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext).Exist
If Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext).Exist Then
sWebChkboxexist = Trim(Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext).ChildItemCount(sRow, sCol, "WebCheckBox"))
'msgbox "Existence:"& sWebChkboxexist
If sWebChkboxexist = 1 Then
Set SetCheckBox = Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext).ChildItem(sRow, sCol, "WebCheckBox", 0)

SetCheckBox.Set sOperation
sCheckBox = Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext).GetCellData(sRow, sCol)
'Msgbox "Check Box '" & sCheckBox & "' in table at Row" & CStr(sRow) & ", Column " & CStr(sCol) & " is made "&sOperation&"."
Call GenerateTestStatus(iTestNo, FCR_PASS, "Operate Check Box in Table ", "Check Box '" & sCheckBox & "' in table at Row" & CStr(sRow) & ", Column " & CStr(sCol) & " is made "&sOperation&".")

Else
'Msgbox "Check Box '" & sCheckBox & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is not found."
Call GenerateTestStatus(iTestNo, FCR_WARNING, "Operate Check Box in Table ", "Check Box '" & sCheckBox & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is not found.")

End If
Else
'Msgbox "Web Table '" & CStr(sTableName) & "' not found in a given Page :" & CStr(sPageName) & "."
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Operate Check Box in Table ", "Web Table '" & CStr(sTableName) & "' not found in a given Page :" & CStr(sPageName) & ".")

End If
End Sub

Sub EnterOCSCriteria(sBrowserName,sPageName,sInnertext,sRow,sCol,sChkOperation,sMoveBttn,sOkLink,iTestNo)

' HELP
' method: EnterData
' returns: None
' parameter: sEdName,sValue
' notes: This will enter the given data in the given text box
' END

Browser(sBrowserName).Page(sPageName).sync
'Msgbox Browser(sBrowserName).Page(sPageName).Exist
'Msgbox Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext,"index:="&iIndex).Exist

If Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext,"index:="&iIndex).Exist Then
sWebChkboxexist = Trim(Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext,"index:="&iIndex).ChildItemCount(sRow, sCol, "WebCheckBox"))
'msgbox "Existence:"& sWebChkboxexist
'If sWebChkboxexist = 1 Then
Set SetCheckBox = Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext,"index:="&iIndex).ChildItem(sRow, sCol,"WebCheckBox", 0)

SetCheckBox.Set sChkOperation


''msgbox "SetCheckBox: "& SetCheckBox
'SetCheckBox.Set sChkOperation
sCheckBox = Browser(sBrowserName).Page(sPageName).WebTable("innertext:="&sInnertext,"index:="&iIndex).GetCellData(sRow, sCol)
'Msgbox "Check Box '" & sCheckBox & "' in table at Row" & CStr(sRow) & ", Column " & CStr(sCol) & " is made "&sChkOperation&"."
Call GenerateTestStatus(iTestNo, FCR_PASS, "Operate Check Box in Table ", "Check Box '" & sCheckBox & "' in table at Row" & CStr(sRow) & ", Column " & CStr(sCol) & " is made "&sChkOperation&".")

' Else
'Msgbox "Check Box '" & sCheckBox & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is not found."
'Call GenerateTestStatus(iTestNo, FCR_WARNING, "Operate Check Box in Table ", "Check Box '" & sCheckBox & "' in table at " & CStr(sRow) & ", Column " & CStr(sCol) & " is not found.")

'End If
Else
'Msgbox "Web Table '" & CStr(sTableName) & "' not found in a given Page :" & CStr(sPageName) & "."
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Operate Check Box in Table ", "Web Table '" & CStr(sTableName) & "' not found in a given Page :" & CStr(sPageName) & ".")

End If
wait 3
If sMoveBttn <> "" then
If Browser(sBrowserName).Page(sPageName).WebButton("name:="&sMoveBttn).Exist Then

'msgbox sMoveBttn&"Exists"
Browser(sBrowserName).Page(sPageName).WebButton("name:="&sMoveBttn).Click
Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the button", " Name ' " & sMoveBttn & "' found and clicked Sucessfully." )

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the button", " Name ' " & sMoveBttn & "' not found to click." )

End If
End if
wait 2
If sOkLink <> "" then
If Browser(sBrowserName).Page(sPageName).Link("name:="&sOkLink,"html tag:=A").Exist Then

Browser(sBrowserName).Page(sPageName).Link("name:="&sOkLink,"html tag:=A").Click
Call GenerateTestStatus (iTestNo,FCR_PASS, "Click on the Link", " Name ' " & sOkLink & "' found and clicked Sucessfully." )

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Click on the Link", " Name ' " & sOkLink & "' not found to click." )

End If
End if


End Sub




Function VerifyObjectNotExists(sBrowserName, sPageName, sObjectName, sObjectType,iTestNo)

' HELP
' method: VerifyObjectNotExists()
' returns: Pass/Fail of the execution(0/1).
' parameter: sObjectName: Name of the object which to be verified.
' parameter: sObjectType: Type of the object can be verified are :-
'"WebElement","WebButton","WebEdit","WebList",'"Link","Image","WebButton","WebCheck","WebRadio"
' notes: This function verifies whether passed object as input is found or not.
' END

Dim sTitle


Select Case sObjectType

Case "WebElement":
Browser(sBrowserName).Page(sPageName).sync

If not Browser(sBrowserName).Page(sPageName).WebElement(sObjectName).Exist Then
VerifyObjectNotExists = true

Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed." )

'Reporter.ReportEvent MicPass, "Verified Object ", " Test ID " & sTestID & "-" & sObjectType & "Name and Type " & sObjectName & " " & sObjectType & vbCrLf & " is not existed in the Page."
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page." )
End If

Case "WebButton":

Browser(sBrowserName).Page(sPageName).sync
'msgbox Browser(sBrowserName).Page(sPageName).Exist
'msgbox Browser(sBrowserName).Page(sPageName).WebButton("html tag:=BUTTON", "name:=" & sObjectName, "type:=button", "index:=" & iIndex).Exist

If not Browser(sBrowserName).Page(sPageName).WebButton("html tag:=BUTTON", "name:=" & sObjectName, "type:=button", "index:=" & iIndex).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "WebRadioGroup":

Dim iWebRadioButtonGroupItems

Browser(sBrowserName).Page(sPageName).sync

If not Browser(sBrowserName).Page(sPageName).WebRadioGroup("html tag:=INPUT", "name:=" & sObjectName, "index:=" & iIndex).Exist Then
VerifyObjectNotExists = true

Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "WebCheckBox":

Browser(sBrowserName).Page(sPageName).sync
If not Browser(sBrowserName).Page(sPageName).WebCheckBox("index:=" & iIndex, "name:=" & sObjectName).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "WebEdit":
Browser(sBrowserName).Page(sPageName).sync
If not Browser(sBrowserName).Page(sPageName).WebEdit("name:=" & sObjectName, "type:=text", "index:=" & iIndex).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "Link":

Browser(sBrowserName).Page(sPageName).sync
If not Browser(sBrowserName).Page(sPageName).Link("html tag:=A", "text:=" & sObjectName, "index:=" & iIndex).Exist Then
VerifyObjectNotExists = true

Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "WebList":

Browser(sBrowserName).Page(sPageName).sync
If not Browser(sBrowserName).Page(sPageName).WebList("name:=" & sObjectName, "html tag:=SELECT", "index:=" & iIndex).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "Image":

Browser(sBrowserName).Page(sPageName).sync

If not Browser(sBrowserName).Page(sPageName).Image(sObjectName).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If


Case "WebTable":

Browser(sBrowserName).Page(sPageName).sync

If not Browser(sBrowserName).Page(sPageName).WebTable(sObjectName).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false

Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "Browser":

If not Browser(sBrowserName).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed .")
Else

VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed .")
End If

Case "Dialog":

If not Browser(sBrowserName).Dialog(sPageName).Exist Then

VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

Case "WinButton":

If not Browser(sBrowserName).Dialog(sPageName).WinButton("text:=" & sObjectName).Exist Then
VerifyObjectNotExists = true
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is not existed in the Page" & CStr(sPageName) & ".")
Else
VerifyObjectNotExists = false
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify Object ", "Name'" & sObjectName & "' and type '" & sObjectType & "' is existed in the Page" & CStr(sPageName) & ".")
End If

End Select


End Function



Function VerifyDisplayText(sBrowserName,strTagName,strMessage,iTestNo)

' HELP
' method: VerifyDisplayText()
' returns: Pass/Fail of the execution(0/1).
' parameter: strTagName: Name of the Html Tag which to be verified.
' parameter: strMessage: Expected string which to be verified is passed

' notes: This function verifies whether string passed as input is found or not.
' END
Dim i
bFound = "False"
Set objHTMLDoc = Browser("name:="& sBrowserName).Object.Document
Set colTags = objHTMLDoc.GetElementsByTagName(strTagName)
iCount = colTags.length
For i = 0 to iCount - 1 Step 1
'Chekc for the message
'Msgbox UCase(trim(colTags.Item(i).innertext))& "is Checked with" &UCase(trim(strMessage))
'If UCase(trim(colTags.Item(i).innertext))= UCase(trim(strMessage)) Then
If strcomp(UCase(trim(colTags.Item(i).innertext)),UCase(trim(strMessage)))=0 Then
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify text in Page", "Verified '"& strMessage &"' message successfully on the page'"&sBrowserName&"' .")
bFound = "True"
'VerifyDisplayText = True
Exit For
End If

Next
'Msgbox bFound &"after next:"
If Not bFound Then
'Msgbox bFound &"inside the Not block"
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Verify text in Page", "Verified '"& strMessage &"' message not found on the page'"&sBrowserName&"' .")
'VerifyDisplayText = "False"
'Exit Function

End If

Set colTags = Nothing
Set objHTMLDoc = Nothing
VerifyDisplayText = bFound



End Function



Sub VerifyCheckBoxState(sBrowserName, sPageName, sObjectName, sState,iTestNo)

' HELP
' method: VerifyCheckBoxState()
' Notes: This is to verify the given state is set in the check box
' parameter: sObjectName : Name of the WebCheckBox ,sState :Expected state of the check box
' END

Dim sChked
'sChked = 1
'sNotChked = 0
Browser(sBrowserName).Page(sPageName).sync

If Browser(sBrowserName).Page(sPageName).WebCheckBox("name:="&sObjectName).Exist Then

sWebCheckBoxState = Browser(sBrowserName).Page(sPageName).WebCheckBox("name:="&sObjectName).GetROProperty("checked")
If cint(sWebCheckBoxState) = 1Then
sStatus = "Checked"
Else
sStatus = "UnChecked"
End If

If cint(sWebCheckBoxState) =cint(sState) Then

'Msgbox "Sucessfully verified for Name '"& sObjectName &"'is in " &sStatus & "state."
Call GenerateTestStatus (iTestNo,FCR_PASS," Verify State of CheckBox ","Sucessfully verified for Name '"& sObjectName &"'is in " &sStatus & "state.")
'Call GenerateTestStatus (iTestNo,FCR_PASS," Verify State of CheckBox "," Sucessfully verified for Name '" sObjectName &"'is in the state:" &sWebCheckBoxState)
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify State of CheckBox "," Name '"& sObjectName &"'is in " &sStatus & "state.")

End If

Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify State of CheckBox ","Name '" &sObjectName &"' doesn't exists in the page.")
End If


End Sub


Sub VerifyRadioGroupState(sBrowserName, sPageName, sWebRadioGroupName, sExpRadioGroupState,iIndex,iTestNo)

' HELP
' method: VerifySelectedRadiobutton()
' notes: This is to Verify the Name of the Radio Button Seleted or Not Selected
' parameter: sWebRadioGroupName as name of the Web Radio Group ,sWebRadioButtonName as name of the Radio Button to Verify
' END

Dim bWebRadioGroupState

Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebRadioGroup("html tag:=INPUT", "name:=" & sWebRadioGroupName,"index:=&iIndex").Exist Then

bWebRadioGroupState = Browser(sBrowserName).Page(sPageName).WebRadioGroup("html tag:=INPUT", "name:=" & sWebRadioGroupName,"index:=&iIndex").GetROProperty("checked")

If cint(bWebRadioGroupState) = 1Then
sStatus = "Selected"
Else
sStatus = "UnSelected"
End If

If StrComp(cint(bWebRadioGroupState),cint(sExpRadioGroupState)) = 0 Then
'Msgbox "Passed" & bWebRadioButtonState
Call GenerateTestStatus (iTestNo,FCR_PASS," Check Radio Group state ","Name '" &sWebRadioGroupName &"' is in " &sStatus&" state .")

Else
'Msgbox "Failed" & bWebRadioButtonState
Call GenerateTestStatus (iTestNo,FCR_FAIL," Check Radio Group state ","Name '" &sWebRadioGroupName &"' is in " &sStatus&" state .")
' Reporter.ReportEvent MicFail, " Verification of a NoN Selected Web Radio Button", "Name of the radio button Not Selected is :" & CStr(sWebRadioButtonName)
End If
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL," Check Radio Group state ","Name '" &sWebRadioGroupName &"'doesn't exist.")

End If

End Sub

Sub VerifyWebListItem(sBrowserName, sPageName, sWebListName,sExpCount,iItemIndx,sExpItem,iTestNo)

' HELP
' method: VerifyWebListState()
' notes: This is to retrieve the Disabled Property of an Web Edit Based on Index
' parameter: sWebEditName as Name of the Web Edit ,iIndex : Number of the WEeb Edit in Page
' END


Browser(sBrowserName).Page(sPageName).sync
If Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).Exist then
bWebListstate = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetRoProperty("disabled")
If bWebListstate = 0 Then

sWebListitemCount = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetRoProperty("items count")

If cstr(sExpCount) <> "" Then
If strComp(cStr(sWebListitemCount),cstr(sExpCount),vbTextCompare)= 0 Then
'Msgbox "Name '" &sWebListName &"' is matched with expected items count '"&sWebListitemCount&"'."
Call GenerateTestStatus (iTestNo,FCR_PASS," Check WebList item ","Name '" &sWebListName &"' is matched with expected items count '"&sWebListitemCount&"'.")
Else
'Msgbox "Name '" &sWebListName &"' is not matched with expected items count '"&sWebListitemCount&"'."
Call GenerateTestStatus (iTestNo,FCR_PASS," Check WebList item ","Name '" &sWebListName &"' is not matched with expected items count '"&sWebListitemCount&"'.")
End If
End If

If cstr(iItemIndx) <> "" Then
sWebListitem = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName,"html tag:=SELECT", "index:=" & iIndex).Getitem(cInt(iItemIndx))

If Strcomp(trim(LCase(sWebListitem)),trim(LCase(sExpItem)),vbTextCompare )= 0 Then
'Msgbox "Name '" &sWebListName &"' is matched is at expected index of Specified item"&iItemIndx
Call GenerateTestStatus (iTestNo,FCR_PASS," Verify item in Web List ","Name '" &sWebListName &"' Item '"&sWebListitem &"' is at expected index of Specified item.")
Else
'Msgbox "Name '" &sWebListName &"' isnot matched is at expected index of Specified item"&iItemIndx
Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify item in Web List ","Name '" &sWebListName &"' Item '"&sWebListitem &"' is not at expected index of Specified item.")
End if
Else
' it has to be updated for checking all the items if exist then return.

For iItem = 1 To sWebListitemCount
'get the list item present at iItem position
stext = Browser(sBrowserName).Page(sPageName).WebList("name:=" & sWebListName, "html tag:=SELECT", "index:=" & iIndex).GetItem(iItem)
If StrComp(LCase(stext), LCase(sExpItem),vbTextComapre) = 0 Then

bStatus = true
Exit for
End If
Next

If bStatus Then

' msgbox "The List Items from WebList '"&sWebListName &"' contains expected item " & CStr(sExpItem)&"."
Call GenerateTestStatus (iTestNo,FCR_PASS, "Verify item in Web List ", "The List Items from WebList '"&sWebListName &"' contains expected item '" & CStr(sExpItem)&"' .")

Else
'Msgbox "The List Items from WebList '"&sWebListName &"' doesn't contains expected item " & CStr(sExpItem)&"."
Call GenerateTestStatus (iTestNo,FCR_FAIL,"Verify item in Web List ", "The List Items from WebList '"&sWebListName &"' doesn't contains expected item '" & CStr(sExpItem)&"'.")
End If

End if
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL,"Verify item in Web List ","Name '" &sWebListName &"' is in disabled state.")
End If

Else

Call GenerateTestStatus (iTestNo,FCR_FAIL," Verify item in Web List ","Name '" &sWebListName &"' doesn't exists in the Page.")
End If

End Sub



Sub SendHotKeys(sValue)
Dim sData
If sValue <> "" Then
set WshShell = WScript.CreateObject("WScript.Shell")
'sValue = "1wert3"
strLen = len(sValue)
For iCnt = 1 to strLen
sData = Mid(sValue,iCnt,1)
WshShell.SendKeys sData
'Msgbox ss
Next
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Send data through Hot Keys ", " Data '" & CStr(sData) & "' is entered in the Control." )
Else
Call GenerateTestStatus (iTestNo,FCR_FAIL, "Send data through Hot Keys ", " Data '" & CStr(sValue) & "' is empty to enter in the Control." )
End If

End Sub


Sub VarCalc(sBrowserName,sPageName,sTableName,sRow,sCol,sAmountType,iTestNo)
'msgbox iIndex

If Browser(sBrowserName).Page(sPageName).WebTable("name:="&sTableName,"index:="&iIndex).Exist Then
sCellData = Browser(sBrowserName).Page(sPageName).WebTable("name:="&sTableName,"index:="&iIndex).GetCellData(sRow,sCol)
'msgbox sCellData
'GetCellData(sBrowserName, sPageName, sTableName, sRow, sCol,iTestNo)
sVarVal= Split(sCellData,"%")
sVarArr = Split(sVarVal(0)," ")
sVarArrCh = Mid(sVarArr(0),1,1)
If strComp(sVarArrCh,"(")= 0 Then


sVarArrOne = Mid(trim(sVarArr(0)),2,len(trim(sVarArr(0)))-2)
'msgbox sVarArrOne
sVarArrTwo = Mid(trim(sVarArr(1)),2,len(trim(sVarArr(1)))-2)
sCalcVal= cdbl(sVarArrOne) - cdbl(sVarArrTwo)
If strcomp(sCalcVal,"0",vbtextcompare)=0 Then
sCalcVal = "0.00"
sCalcVarPer = "0.0"
Else
sCalcVarPer = sCalcVal/trim(sVarArr(2))*100
sCalcVarPer = Round(sCalcVarPer,1)
End If
' If strcomp(sCalcVarPer,"0",vbtextcompare)=0 Then
' sCalcVarPer = "0.0"
' End If
Else
sCalcVal= trim(sVarArr(0)) - trim(sVarArr(1))
If strcomp(sCalcVal,"0",vbtextcompare)=0 Then
sCalcVal = "0.00"
sCalcVarPer = "0.0"
Else
sCalcVarPer = cdbl(sCalcVal)/trim(sVarArr(2))*100
sCalcVarPer = Round(sCalcVarPer,1)
' If strcomp(sCalcVarPer,"0",vbtextcompare)=0 Then
' sCalcVarPer = "0.0"
End If
End If

If sCalcVal = trim(sVarArr(2)) Then
'Msgbox "Passed " & sCalcVal &"is matched with "&sVarArr(2)
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify Variance Amount in Page", "The Expected Value '" & CStr(sCalcVal) & "' is matched with Actual value '" & sVarArr(2)& "'.")
Else
'Msgbox "Failed " & sCalcVal &"is matched with "&sVarArr(2)
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify Variance Amount in Page", "The Expected Value '" & CStr(sCalcVal) & "' doesn't match with Actual value '" & sVarArr(2)& "'.")
End If
If sCalcVarPer = trim(sVarArr(3)) Then
'Msgbox "Passed " & sCalcVarPer &"is matched with "&sVarArr(3)
Call GenerateTestStatus(iTestNo, FCR_PASS, "Verify Variance Percentage in Page", "The Expected Value '" & CStr(sCalcVarPer) & "' is matched with Actual value '" & sVarArr(3)& "'.")
Else
'Msgbox "Failed " & sCalcVarPer &"is matched with "&sVarArr(3)
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify Variance Percentage in Page", "The Expected Value '" & CStr(sCalcVarPer) & "' doesn't match with Actual value '" & sVarArr(3)& "'.")
End If
Else
Call GenerateTestStatus(iTestNo, FCR_FAIL, "Verify CellData in WebTable", "Web Table '" & CStr(sTableName) & "' table is not found.")
End If
End Sub

Comments

Popular posts from this blog

PDF Automation in QTP

                                                                            The most challenging issue with PDFs is that it could be of any kind, not just a tabular data; it could have plain text, images or even forms to fill up. So this makes a tester’s life a bit difficult, never mind, we will definitely find an easy of do it… Although there are already some better approaches we have to deal with PDF documents but I found many of us are facing so many difficulties using this. There are lots of queries coming at QTP forums asking for an easy way of doing it with PDFs. keeping those in my mind I started c...

Convert JSON to XML using QTP/UFT/VBScript

Sample Code : Dim strPage,strJSON,objIE strPage = "C:\Jay\JLoader.html" Set objIE = CreateObject("InternetExplorer.Application") objIE.Visible = True objIE.Navigate2 strPage While objIE.Busy : Wend strJSON = "{""FirstName"":""Jay"", ""LastName"":""Krishna""}" Set objWin = objIE.document.parentWindow objWin.execScript "var jsonStr2XML = function(strJSON) { return json2xml(JSON.parse(strJSON));};" Msgbox  oWin.jsonStr2XML(strJSON) objIE.Quit In Detail: Converting The most popular data interchange format JSON(JavaScript Object Notation) to XML using QTP/UFT. Parsing JSON in UFT could be a challenge so we will use JavaScript in UFT to make it perfect. SO We need :              Java Script API  - To Convert JSON to XML                         JavaScript Files :  ...

Download Test Resource From QC Using QTP

'########################################################################### '* Function Name: QCGetResource '* Designer: Jay '* Date 09-May-2012 '* This script will Download QC Test Resource to a local dir '########################################################################### Function QCGetResource(resourceName,saveTo)     Set qcConn = QCUtil.QCConnection     Set oResource = qcConn.QCResourceFactory     Set oFilter = oResource.Filter     oFilter.Filter("RSC_FILE_NAME") = resourceName     Set oResourceList = oFilter.NewList     If oResourceList.Count = 1 Then         Set oFile = oResourceList.Item(1)         oFile.FileName = resourceName         oFile.DownloadResource saveTo, True     End If         Set qcConn = Nothing     Set oResource = Nothi...

compare Two Text files using Vb Script

Public Function CompareFiles (FilePath1, FilePath2) Dim FS, File1, File2 Set FS = CreateObject(“Scripting.FileSystemObject”) If FS.GetFile(FilePath1).Size <> FS.GetFile(FilePath2).Size Then CompareFiles = True Exit Function End If Set File1 = FS.GetFile(FilePath1).OpenAsTextStream(1, 0) Set File2 = FS.GetFile(FilePath2).OpenAsTextStream(1, 0) CompareFiles = False Do While File1.AtEndOfStream = False Str1 = File1.Read(1000) Str2 = File2.Read(1000) CompareFiles = StrComp(Str1, Str2, 0) If CompareFiles <> 0 Then CompareFiles = True Exit Do End If Loop File1.Close() File2.Close() End Function Return value: The function returns 0 or False if the two files are identical, otherwise True. Example: File1 = “C:\countries\apple1.jpg” File2 = “C:\countries\apple3.jpg” If CompareFiles(File1, File2) = False Then MsgBox “Files are identical.” Else MsgBox “Files are different.” End If    Source: Mercury Forum’s KB articles

CreateImageFromClipBoard using QTP

'-------------------------------------------------------------------------' Method : CreateImageFromClipBoard' Author : Jai Purpose : It gets the clipboard image and convert as a image file.' Parameters: FileName - String, contains the BMP file name' iIndex - Integer, contains the Worksheet index' Returns : String. The replaced file name it gives.' Caller : - Nil' Calls : - Nil' ------------------------------------------------------------------------- Sub CreateImageFromClipBoard(sFileName) Dim wshShell,ShellReturnCode, sCmdExec Set WshShell = WScript.CreateObject("WScript.Shell") sCmdExec = "D:\autostuff\i_view32.exe /silent /clippaste /convert="& sFileName ShellReturnCode = WshShell.Run(sCmdExec, 1, True) End Sub