back to nexaweb
search
Close source view

  1. ' get the app object
  2. Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
  3.  
  4. ' get the buttons in the app
  5. Set labelObj = appObj.findObjectById( "labelWithPopupMenu" )
  6. Set textFieldObj = appObj.findObjectById( "tfReport" )
  7.  
  8.  
  9. ' right click to get popup menu
  10. labelObj.fireRightMouseClick
  11.  
  12. ' get the popup menu
  13. Set popupMenu = appObj.getPopup()
  14.  
  15.  
  16. ' get the first menu item
  17. Set menuItem = popupMenu.getMenuItemAt( 0 )
  18.  
  19. 'verify the menu item text
  20. text = menuItem.getText()
  21. if( text <> "A menu item") then
  22.         Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'A menu item'.   Acutal was "+text
  23. else
  24.     Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
  25. End if
  26.  
  27. ' select the menu item
  28. menuItem.select
  29.  
  30. 'verify the text field was set correctly
  31. text = textFieldObj.getText()
  32. if( text <> "First Menu Item") then
  33.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'First Menu Item'.   Acutal was "+text
  34. else
  35.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  36. End if
  37.  
  38. ' right click to get popup menu
  39. labelObj.fireRightMouseClick
  40.  
  41. ' get the popup menu
  42. Set popupMenu = appObj.getPopup()
  43.  
  44.  
  45. ' get the second menu item
  46. Set menuItem = popupMenu.getMenuItemAt( 1 )
  47.  
  48.  
  49. 'verify the menu item text
  50. text = menuItem.getText()
  51. if( text <> "Another menu item") then
  52.         Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'Another menu item'.   Acutal was "+text
  53. else
  54.     Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
  55. End if
  56.  
  57. ' select the menu item
  58. menuItem.select
  59.  
  60.  'verify the text of the tooltip
  61. text = textFieldObj.getText()
  62. if( text <> "Second Menu Item") then
  63.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'Second Menu Item'.   Acutal was "+text
  64. else
  65.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  66. End if
  67.  

© Copyright 2005-2008 Nexaweb Technologies Inc. All Rights Reserved.