'****************************************************************************************************************************
'Function Name -------- Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'Description ------------ Use this function validate the displayed Error pop up
'Parameters ----------- ip_strExpectPopUpDetails : EX: Y|Invalid Date|OK or N|NO Message
'Return Value ---------
' 1: Indicates expected pop up is displayed (Need to exit the component on this event)
' 1: Indicates expected pop up is not displayed (Need to exit the component on this event)
' 1: Unexpectedly pop up is displayed (Need to exit the component on this event)
' 0: Unexpected pop up is not displayed (Need not to exit the component on this event)
'Example -------------- Call Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'****************************************************************************************************************************
Function Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'<<< Local variable declaration >>>
Dim arrErrorMessageDetails, strErrorMsg, blnFlag
Fun_ValidateExpectedPopUp = "1" '
arrErrorMessageDetails = Split(ip_strExpectPopUpDetails, "|")
If UCase(arrErrorMessageDetails(0)) = "Y" Then
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstMidWaitTime) Or _
Browser("Browser Main").Dialog("Message from webpage").Exist(intConstMidWaitTime) Then
'<<< Expected Pop Up expectedly displayed => Success >>>
'<<< Validating the error message >>>
strErrorMsg = ""
If Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").Exist(intConstShortWaitTime) Then
strErrorMsg = Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").GetROProperty("innertext")
ElseIf Browser("Browser Main").Dialog("Message from webpage").Static("Please").Exist(intConstShortWaitTime) Then
strErrorMsg =Browser("Browser Main").Dialog("Message from webpage").Static("Please").GetROProperty("text")
End If
If Instr(strErrorMsg, arrErrorMessageDetails(1)) Then
'<<< Expected error message is displayed >>>
Fun_ReportSuccess "Validate the pop up Message", "Expected Pop up message is displayed on the pop up Message as:" & VBNewline & strErrorMsg
Else
'<<< Expected error message is not displayed >>>
Fun_ReportFailure "Validate the pop up Message", "Expected Pop up message is not displayed on the pop up message as:" & VBNewline & arrErrorMessageDetails(1) & VBNewline & "Instead it is displayed as:" & VBNewline & strErrorMsg, Browser("Browser Main")
End If
Else
'<<< Expected Pop Up unexpectedly not displayed=> Failure >>>
Fun_ReportFailure "Expected Pop up Validation", "Expected pop up not displayed.", Browser("Browser Main")
End If
Else
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstShortWaitTime) Or _
Browser("Browser Main").Dialog("Message from webpage").Exist(intConstShortWaitTime) Then
strErrorMsg = ""
If Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").Exist(intConstShortWaitTime) Then
strErrorMsg = Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").GetROProperty("innertext")
ElseIf Browser("Browser Main").Dialog("Message from webpage").Static("Please").Exist(intConstShortWaitTime) Then
strErrorMsg =Browser("Browser Main").Dialog("Message from webpage").Static("Please").GetROProperty("text")
End If
'<<< Unexpected Pop Up unexpectedly displayed => Failure >>>
Fun_ReportFailure "Unexpected Pop up Validation", "Unexpected pop up is displayed with text as:" & VBNewLine & strErrorMsg, Browser("Browser Main")
Else
'<<< Unexpected Pop Up expectedly not displayed=> Success >>>
Fun_ReportSuccess "Unexpected Pop up Validation", "No pop ups displayed as expected."
Fun_ValidateExpectedPopUp = "0"
End If
End If
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstShortWaitTime) Then
Browser("Browser Main").Window("-- Web Page Dialog").Close
ElseIf Browser("Browser Main").Dialog("Message from webpage").Exist(intConstShortWaitTime) Then
Browser("Browser Main").Dialog("Message from webpage").Close
End If
End Function
'****************************************************************************************************************************
'SubRoutine Name -------- sub_popUpValidate(ip_ExpectPopUp)
'Description ------------ Use this sub routine to call the eexpected pop up funtion and handling the pop up message
'Author ----------------- Naresh gupta
'Parameters ----------- ip_ExpectPopUp : EX: Parameter("p_SC_CSS_ExpectPopUp")
'Return Value --------- NA
'Registerd To ---------- NA
'Base Project ---------- EFAS
'Example -------------- Call sub_popUpValidate(Parameter("p_SC_CSS_ExpectPopUp"))
'****************************************************************************************************************************
Sub sub_popUpValidate(ip_strExpectPopUp)
Dim returnVal
returnVal = Fun_ValidateExpectedPopUp(ip_strExpectPopUp)
If Cstr(returnVal) = "1" Then
ExitComponentIteration
End If
End Sub
'Function Name -------- Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'Description ------------ Use this function validate the displayed Error pop up
'Parameters ----------- ip_strExpectPopUpDetails : EX: Y|Invalid Date|OK or N|NO Message
'Return Value ---------
' 1: Indicates expected pop up is displayed (Need to exit the component on this event)
' 1: Indicates expected pop up is not displayed (Need to exit the component on this event)
' 1: Unexpectedly pop up is displayed (Need to exit the component on this event)
' 0: Unexpected pop up is not displayed (Need not to exit the component on this event)
'Example -------------- Call Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'****************************************************************************************************************************
Function Fun_ValidateExpectedPopUp(ip_strExpectPopUpDetails)
'<<< Local variable declaration >>>
Dim arrErrorMessageDetails, strErrorMsg, blnFlag
Fun_ValidateExpectedPopUp = "1" '
arrErrorMessageDetails = Split(ip_strExpectPopUpDetails, "|")
If UCase(arrErrorMessageDetails(0)) = "Y" Then
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstMidWaitTime) Or _
Browser("Browser Main").Dialog("Message from webpage").Exist(intConstMidWaitTime) Then
'<<< Expected Pop Up expectedly displayed => Success >>>
'<<< Validating the error message >>>
strErrorMsg = ""
If Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").Exist(intConstShortWaitTime) Then
strErrorMsg = Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").GetROProperty("innertext")
ElseIf Browser("Browser Main").Dialog("Message from webpage").Static("Please").Exist(intConstShortWaitTime) Then
strErrorMsg =Browser("Browser Main").Dialog("Message from webpage").Static("Please").GetROProperty("text")
End If
If Instr(strErrorMsg, arrErrorMessageDetails(1)) Then
'<<< Expected error message is displayed >>>
Fun_ReportSuccess "Validate the pop up Message", "Expected Pop up message is displayed on the pop up Message as:" & VBNewline & strErrorMsg
Else
'<<< Expected error message is not displayed >>>
Fun_ReportFailure "Validate the pop up Message", "Expected Pop up message is not displayed on the pop up message as:" & VBNewline & arrErrorMessageDetails(1) & VBNewline & "Instead it is displayed as:" & VBNewline & strErrorMsg, Browser("Browser Main")
End If
Else
'<<< Expected Pop Up unexpectedly not displayed=> Failure >>>
Fun_ReportFailure "Expected Pop up Validation", "Expected pop up not displayed.", Browser("Browser Main")
End If
Else
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstShortWaitTime) Or _
Browser("Browser Main").Dialog("Message from webpage").Exist(intConstShortWaitTime) Then
strErrorMsg = ""
If Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").Exist(intConstShortWaitTime) Then
strErrorMsg = Browser("Browser Main").Window("-- Web Page Dialog").Page("Page").WebElement("WebTable").GetROProperty("innertext")
ElseIf Browser("Browser Main").Dialog("Message from webpage").Static("Please").Exist(intConstShortWaitTime) Then
strErrorMsg =Browser("Browser Main").Dialog("Message from webpage").Static("Please").GetROProperty("text")
End If
'<<< Unexpected Pop Up unexpectedly displayed => Failure >>>
Fun_ReportFailure "Unexpected Pop up Validation", "Unexpected pop up is displayed with text as:" & VBNewLine & strErrorMsg, Browser("Browser Main")
Else
'<<< Unexpected Pop Up expectedly not displayed=> Success >>>
Fun_ReportSuccess "Unexpected Pop up Validation", "No pop ups displayed as expected."
Fun_ValidateExpectedPopUp = "0"
End If
End If
If Browser("Browser Main").Window("-- Web Page Dialog").Exist(intConstShortWaitTime) Then
Browser("Browser Main").Window("-- Web Page Dialog").Close
ElseIf Browser("Browser Main").Dialog("Message from webpage").Exist(intConstShortWaitTime) Then
Browser("Browser Main").Dialog("Message from webpage").Close
End If
End Function
'****************************************************************************************************************************
'SubRoutine Name -------- sub_popUpValidate(ip_ExpectPopUp)
'Description ------------ Use this sub routine to call the eexpected pop up funtion and handling the pop up message
'Author ----------------- Naresh gupta
'Parameters ----------- ip_ExpectPopUp : EX: Parameter("p_SC_CSS_ExpectPopUp")
'Return Value --------- NA
'Registerd To ---------- NA
'Base Project ---------- EFAS
'Example -------------- Call sub_popUpValidate(Parameter("p_SC_CSS_ExpectPopUp"))
'****************************************************************************************************************************
Sub sub_popUpValidate(ip_strExpectPopUp)
Dim returnVal
returnVal = Fun_ValidateExpectedPopUp(ip_strExpectPopUp)
If Cstr(returnVal) = "1" Then
ExitComponentIteration
End If
End Sub