Set textFieldObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").JavaObject("TextField").Object.getScriptObject()
Set menuBarObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").JavaObject("MenuBar").Object.getScriptObject()
itemCount = menuBarObj.getMenuBarItemCount()
'verify the menu item text
if( itemCount <> 5 ) then
Reporter.ReportEvent micFail,"Menu Bar", "Expected menu count to be 5. Acutal was "+ Cstr( itemCount )
else
Reporter.ReportEvent micPass,"Menu Bar", "Got Expected menu count of "+ Cstr( itemCount )
End if
' get the first menu
Set menuObj = menuBarObj.getMenuBarItemAt( 0 )
'verify the menu text
text = menuObj.getText()
if( text <> "Menu 1" ) then
Reporter.ReportEvent micFail,"MenuText", "Expected text 'Menu 1'. Acutal was "+text
else
Reporter.ReportEvent micPass,"Menu Text", "Got Expected text "+text
End if
' select the menu
Set popupMenu = menuObj.select()
' get the first menu item of the popup
Set menuItemObj = popupMenu.getMenuItemAt( 0 )
'verify the menu item text
text = menuItemObj.getText()
if( text <> "Menu 1 MenuItem 1" ) then
Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'Menu 1 MenuItem 1'. Acutal was "+text
else
Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
End if
' select the menu item to fire its onCommand
menuItemObj.select
'verify the text field was set correctly
text = textFieldObj.getText()
if( text <> "Menu 1 MenuItem 1") then
Reporter.ReportEvent micFail,"TextField Text", "Expected text 'Menu 1 MenuItem 1'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
End if
' reselect the first menu
Set popupMenu = menuObj.select()
' get the second menu item
Set menuItemObj = popupMenu.getMenuitemAt( 2 )
'verify the menu item text
text = menuItemObj.getText()
if( text <> "Menu 1 MenuItem 2" ) then
Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'Menu 1 MenuItem 1'. Acutal was "+text
else
Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
End if
' select the menu item to fire its onCommand
menuItemObj.select
'verify the text field was set correctly
text = textFieldObj.getText()
if( text <> "Menu 1 MenuItem 2") then
Reporter.ReportEvent micFail,"TextField Text", "Expected text ''Menu 1 MenuItem 2'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
End if
' get the third menu item (second menu item is a separator)
Set menuObj = menuBarObj.getMenuBarItemAt( 2 )
'verify the menu text
text = menuObj.getText()
if( text <> "Menu 2" ) then
Reporter.ReportEvent micFail,"MenuText", "Expected text 'Menu 2'. Acutal was "+text
else
Reporter.ReportEvent micPass,"Menu Text", "Got Expected text "+text
End if
' select the second menu
Set popupMenu = menuObj.select()
' select the second menu item which is a submenu
Set subMenuObj = popupMenu.getMenuItemAt( 1 )
Set subPopupMenu = subMenuObj.select()
' select the menu item of the sub menu
Set menuItemObj = subPopupMenu.getMenuItemAt( 0 )
menuItemObj.select
'verify the text field was set correctly
text = textFieldObj.getText()
if( text <> "Menu2 SubMenu MenuItem") then
Reporter.ReportEvent micFail,"TextField Text", "Expected text 'Menu2 SubMenu MenuItem'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
End if
' select the fourth item of the menu bar (the third is a separator)
Set menuObj = menuBarObj.getMenuBarItemAt( 4 )
Set popupMenu = menuObj.select()
' select the checkbox menu item
Set menuItemObj = popupMenu.getMenuitemAt( 1 )
menuItemObj.select
'verify the text field was set correctly
text = textFieldObj.getText()
if( text <> "CheckBox MenuItem State true") then
Reporter.ReportEvent micFail,"TextField Text", "Expected text 'CheckBox MenuItem State true'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
End if
Set popupMenu = menuObj.select()
Set menuItemObj = popupMenu.getMenuitemAt( 1 )
menuItemObj.select
'verify the text field was set correctly
text = textFieldObj.getText()
if( text <> "CheckBox MenuItem State false") then
Reporter.ReportEvent micFail,"TextField Text", "Expected text 'CheckBox MenuItem State false'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
End if