Page 1 of 1

Menu items in Maya 2015 (QT)

Posted: Wed Nov 26, 2014 5:03 pm
by Noxxys
Hi,

I'm having trouble with getting proper recognition of menu and submenu items in Maya 2015, which is running on QT. I'm on Ranorex 5.2.1 with native QT support, but the problem is more or less the same with previous versions and the accessibility plugin.

Here is what I see in the Spy, when looking at items of the File menu of Maya:
Image

The File menu is actually a form, as every other menu and submenu. For each menu item, there is an "Element QWidget" and a MenuItem with the proper name.
When recording in Ranorex, the "Element QWidget" is added to the repository. If I change it by the corresponding MenuItem, a click on this element will not be aligned with the menu item. You can see that on the picture above, highlighting the "Save Scene" item displays the outline between "New Scene" and "Open Scene".

I would like to use this MenuItem element, because it has more information, such as the text being displayed. Right now, I can only use the "Element QWidget", which contains no useful information. So the only way I can click on a menu item is by saying: it's element[3]. But if another item is added before that, it will break the test.

Any idea about why it happens and how to fix it?

Thanks
Bruno

Re: Menu items in Maya 2015 (QT)

Posted: Thu Nov 27, 2014 2:34 pm
by Support Team
Hi Bruno,

Unfortunately I was not able to reproduce your mentioned behavior on my side (Ranorex 5.2.1).
May I ask you to update Ranorex to the latest version and try to reproduce the issue?
If the issue still occurs, may I also ask you to attach your Ranorex Solution?

Thank you in advance.

Regards
Markus (S)

Re: Menu items in Maya 2015 (QT)

Posted: Fri Nov 28, 2014 11:11 am
by Noxxys
Thanks for your quick answer Markus.
I was already using version 5.2.1, but I had similar problems with menu items before you added native support for QT.
I tried with the trial version of Maya 2015 that is available on Autodesk's website, and it's the same behavior.

I've found a workaround by doing the following things:
  • Use the recorder as usual to click on the menu items
  • Notice that the items are recorded as QWidget, with an XPath like element[18]
  • Transform the menu into a form by clicking on the dotted line
  • Open the Spy, and press Ctrl + Win while hovering over the menu item
  • Notice that the Spy still selects the same QWidget
  • Select the corresponding MenuItem in the Spy instead
  • Copy the end of the XPath, which is /form[@title='File']/menuitem[@name='importFileItem']\
  • And paste "menuitem[@name='importFileItem']" instead of "element[18]" in the repository
I'd like the recorder to automatically pick the MenuItem instead of the QWidget during recording, that would make much more stable test cases, and I wouldn't have to fix all the items manually. The menu I'm testing often has items removed or added to it during development, and that breaks tests using indexes such as element[18].

I've attached a test solution so you can see the problem. In that solution, there are 3 test cases:
  1. 1. Using_normal_menu
    • Click on File/Import, using the standard File menu. When recording, Ranorex picks element[18] instead of menuitem[@name='importFileItem']
  • 2. Using_form_menu
    • Click on File, then on the dotted line to transform the menu into a form, and click on Import. When recording, Ranorex picks element[18] instead of menuitem[@name='importFileItem']
  • 3. Workaround
    • Do the same as the first test case, but with the workaround I've described above, manually replace "element[18]" with "menuitem[@name='importFileItem']" in the XPath of the QWidget in the repository
Cheers

Re: Menu items in Maya 2015 (QT)

Posted: Thu Dec 04, 2014 4:16 pm
by Support Team
Hi Bruno,

Thank you for your Solution and the additional information.
I've already forwarded this situation to our responsible development department. One of my colleagues will analyze it in more detail and I'll update this posting as soon as I receive any information.

May I ask you to use the workarounds you've mentioned?

Regards,
Markus (S)