The problem you faced is caused by the following: When TestComplete calls the native Click method of your submenu, the control goes to the method and does not return to TestComplete until the Click() routine finishes executing. However, the routine does not finish executing until a user performs some actions with the appeared window. TestComplete cannot simulate the user actions since it is waiting for finishing the Click() method.
Thus, the only way to solve the problem is not to call the native Click() method and use some other way to select a menu item: You can select a menu item by using keyboard, or by getting the screen coordinates of the item and clicking on it via Desktop.MouseDown and Desktop.MouseUp.
Please refer to the "Using Namespaces" Help topic for information about the NativeWebObject method.
This menu don't allow using keyboard.
Now I am using the screen coordinates, but this way isn't very good. Because I have to select item of other menu and then my sub menu is visible. I have to do many mouse moves until I can click on my submenu. I need to find other way.
We recommend that you create a helper function that would select the needed item from the menu. This function should accept a page object as a parameter and a string containing menu and submenu items that should be selected. In the body of the function, you will need to parse the string and get separate item captions. Then the function will search for the needed items one-by-one and move the mouse pointer over them to make a submenu window visible or to click on the item.
Please let me know if you need an example of such a function - we can create it for you, but it will take some time. Please tell us which scripting language you prefer.
But I have one more problem.
There is a button. I do the following:
button = field ["btn"];
Sometimes this string works. But sometimes I have exception:
The object doesn't support this property or method