' get the app object
Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
' get the window
Set windowObj = appObj.getWindowAt( 0 )
' get the content panel
Set contents = windowObj.getContentPanel()
' get the label subpanel and get the label being set by the buttons
Set labelPanel = contents.getChildObjectAt( 1 )
Set checkLabel = appObj.findObject( labelPanel, "/label[@id='clicklabel']" )
' get the button panel
Set buttonPanel = contents.getChildObjectAt( 0 )
' click the first button
Set buttonObj = buttonPanel.getChildObjectAt( 0 )
buttonObj.click
' test the label to ensure the code behind the button was fired correctly
labelText = checkLabel.getText()
if( labelText <> "Button 1 Clicked") then
Reporter.ReportEvent micFail,"Label Text", "Expected 'Button 1 Clicked'. Acutal is "+labelText
Else
Reporter.ReportEvent micPass,"Label Text", "Got expected result " + labelText
End If
' click the second button
Set buttonObj = buttonPanel.getChildObjectAt( 1 )
buttonObj.click
' test the label to ensure the code behind the button was fired correctly
labelText = checkLabel.getText()
if( labelText <> "Button 2 Clicked") then
Reporter.ReportEvent micFail,"Label Text", "Expected 'Button 2 Clicked'. Acutal is "+labelText
Else
Reporter.ReportEvent micPass,"Label Text", "Got expected result " + labelText
End If
' click the third button
Set buttonObj = buttonPanel.getChildObjectAt( 2 )
buttonObj.click
' test the label to ensure the code behind the button was fired correctly
labelText = checkLabel.getText()
if( labelText <> "Button 3 Clicked") then
Reporter.ReportEvent micFail,"Label Text", "Expected 'Button 3 Clicked'. Acutal is "+labelText
Else
Reporter.ReportEvent micPass,"Label Text", "Got expected result " + labelText
End If