10-08-2010, 04:15 PM
Hi,
You may take the basic idea from the below code.
The logic is simple submit the form with blank mandatory field & validate the text of popup message.
I hope this will help you....
You may take the basic idea from the below code.
The logic is simple submit the form with blank mandatory field & validate the text of popup message.
Code:
'/ * used of child object to to find out simlar objects(includes mandatory object too)
Set objDef = Description.Create
objDef("micclass").value="WebElement" ' specific to app
objDef("html tag").value="DIV" ' specific to app
objDef("class").value="req" ' specific to app
Set arrObj= Browser("Browser Name").Window("Window Name").Page("Page Name").Frame("Frame Name").ChildObjects(objDef)
'/ * Getting the child object count.
n= arrObj.count
'/ * The loop basically used to find out all the mandatory fields visible on the chart window.
For iCnt =1to n-1
'/ * getting the "html id" value of the current child object .
strReq = arrObj(iCnt).GetROProperty("html id") ' specific to app
If len(strReq)>3 Then ' specific to app
'/ * Using the select case to compare the "html id" to find out the required filed.
Select Case strReq
Case "FNAME_REQ" ' specific to app
Browser("Browser Name").Window("Window Name").Page("Patient Chart Page").WebButton("Apply").Click
'/ * Wait for popup box
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").WinButton("OK").WaitProperty "enabled","True",4000
'/ * Checkpoint for verifying the popup box property like text.
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").Static("FieldMessage").Check CheckPoint("First Name")
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").WinButton("OK").Click
'/ * Enter the 'First Name' in the Frame.
Browser("Browser Name").Window("Window Name").Page("Page Name").Frame("Frame Name").WebEdit("First Name").Set "Ankur"
Case "DOB_REQ" ' specific to app
Browser("Browser Name").Window("Window Name").Page("Patient Chart Page").WebButton("Apply").Click
'/ * Wait for popup box
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").WinButton("OK").WaitProperty "enabled","True",4000
'/ * Checkpoint for verifying the popup box property like text.
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").Static("FieldMessage").Check CheckPoint("Birth Date")
Browser("Browser Name").Window("Window Name").Dialog("Windows Internet Explorer").WinButton("OK").Click
'/ * Enter the 'Birth Day' in the Frame.
Browser("Browser Name").Window("Window Name").Page("Page Name").Frame("Frame Name").WebEdit("Month").Set "01"
Browser("Browser Name").Window("Window Name").Page("Page Name").Frame("Frame Name").WebEdit("Day").Set "10"
Browser("Browser Name").Window("Window Name").Page("Page Name").Frame("Frame Name").WebEdit("Year").Set "1995"
End Select
End If
Next
I hope this will help you....