Forum Discussion

lucieneven's avatar
lucieneven
Contributor
14 years ago

VBScript runtime error: Object required: 'commandMenuBar.SwingPopupMenu'

Hello,



I record a few lines of a Java Applet on the web page. When i run the script, i saw the exception:



An exception occurred in the "Unit2" unit at line 33:
Microsoft VBScript runtime error
Object required: 'commandMenuBar.SwingPopupMenu'Microsoft VBScript runtime error

Object required:
'commandMenuBar.SwingPopupMenu'



Basically user click "Project" on the menu bar, it will invoke a submenu, then user clicks the first item on the submenu. The script was recorded as follows:



32:  Call commandMenuBar.SwingMenu.Click("Project")

33:  Call commandMenuBar.SwingPopupMenu.Click(Empty)



As mentioned, line 32 is okay, indeed the submenu has been invoked. However, no operation to click the submenu. Nothing happened, after a while, exception popup as Object required:
'commandMenuBar.SwingPopupMenu'.



I searched the forum and failed to see any posts talking about SwingPopupMenu.



Could you please shed some light here, what we can do in this case?



Thanks so much!



Lucien



p.s. Enclosed snapshot is just for the reference.

1 Reply

  • Hi Lucien,



    It looks like your tested applet uses a non-standard menu control, that's why, the menu selection operation was recorded incorrectly. To resolve the problem, you can try to associate this menu control with a standard Swing menu. To do this, follow the steps below:

    * Double-click your project in the Project Explorer and then select the Properties tab.

    * Select the Object Mapping category.

    * Select the Swing Controls | Menu item.

    * Click Add From Screen.

    * Use the target icon or the pointing cursor to select the Project item on the menu bar in your tested applet. Then, click OK.

    * Save your project.

    After that, re-record the menu selection, play back the new test and see how it works for you.