MSAA and application menu |
Post Reply |
Author | ||||
yngvedh
Newbie Joined: 17 January 2012 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 17 January 2012 at 7:04am |
|||
Hi,
Reading your support guidelines, I'm not sure whether this is a forum question or a support question. I guess the answer to this helps more people than just me. Now, to business. We're using MicroSoft Active Accessibility to automate our UI tests. But We're having a hard time identifying menu items. Ideally, I want to identify menu items by their command ID. Trouble is, the command ID is not available from the CXTPMenuBar we're currently using. We could use the name of the menu item, but that makes it more difficult to test localized versions. (we ship 13 languages) Here's what I got out of the MSAA Inspector tool with our application and a newly created Visual Studio MFC template application (with visual studio style toolbars): XTreme toolkit menu: - ChildID = 0 - Most properties return NOT_IMPLEMENTED New MFC Template Application menu: - ChildID = Command ID - All properties return valid values Is there anything I have to do to enable MSAA? If not, how can I best solve this problem? Best regards, Yngve D. Hammersland |
||||
grahamf
Groupie Joined: 29 October 2009 Location: United States Status: Offline Points: 13 |
Post Options
Thanks(0)
|
|||
We had a similar issue, coming from Stingray Toolkit (which had its own menu peculiarities), however, we use MicroFocus SilkTest, so I cannot be more specific for MSAA. I will describe what I found and did, instead of trying to match that with what you have.
In a nutshell, as far as I can figure out, CodeJock only uses the initial menu load to create a menu bar (CXTPMenuBar) that contain lists of controls. After loading, no menu resource (a la Microsoft menu HMENU) are used, and the menu bar/controls are used for drawing the menus. To workaround this, we have a dynamically loaded SilkTest extension DLL that is loaded by the application (if not there, no QA so no error). This DLL exposes a function called by SilkTest to initiate a menu. The menu to select is specified by a text string, like: /File/Do Foo or /File/[cmdid] or /File/{idx} where [cmdid] is the command id, and {idx} is the index within the menu. We then get the CodeJock menu bar controls:
and traverse the controls. At this point, we dump out a key sequence which is used to select the menu (why this is so I explain below). In your case, since it is multi-lingual, you cannot use "/File/Do Foo", but more likely just "[cmdid]". This will need to locate the control in the menu bar controls via FindControl(). I suggest you then go back through the parent control(s) to be able to determine the full key sequence which is used to select the menu. The reason for using the key sequence is so that the menu will actually display (vs just firing off a PostMessage() with the command id), so that command UI updates and control drawing is performed. It also gives the QA person doing the scripting a chance to see what their script and their menu selection is doing (SilkTest allows you to set the keystroke delay). What you wind up with is this key sequence (for above example):
Another like "/Edit/Do Bar" might be:
which will select the menu. Now for the secret sauce with this - the way the CodeJock menu bar activates is rather weird, and although this key sequence would work if you type it, being sent via send keys does not work. What I found was it was necessary to position the mouse over the first menu bar entry, otherwise the sequence would not work correctly (positioning done by SilkTest TypeKeys function). Code snippet:
I hope that helps. |
||||
yngvedh
Newbie Joined: 17 January 2012 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
|||
Hi, thanks for the answer, but it is not quite what I'm looking for.
I just want the menu to act as a native menu, even if I have to manually implement it myself. |
||||
grahamf
Groupie Joined: 29 October 2009 Location: United States Status: Offline Points: 13 |
Post Options
Thanks(0)
|
|||
If you want the menu to act as a 'native' menu (HMENU based, and possibly wrapped by CMenu), you will not be able to use the CodeJock command bar/menu bar since they do not use HMENU except when they initially load the menu resource.
Other CodeJock folks chime in to correct me, though I went through this pretty closely |
||||
pawesol
Newbie Joined: 08 April 2014 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
|||
Hi,
I have the same problem as Yngve. I am using TestComplete. Any explanation why ID is not returned and how to work around it? /Pawel
|
||||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |