Play Back: Unable to find a submenuItem of context menu

Ask general questions here.
btonye
Posts: 7
Joined: Thu Jul 02, 2015 11:48 am

Play Back: Unable to find a submenuItem of context menu

Post by btonye » Mon Sep 21, 2015 10:07 am

I have register the following action:
-open excel file
-select a range of cells, then right click and select sub menu item "copy "
While playing the recording , the sub menu "copy" is not found, then the click is not performed and the test failed.
i've try to track it with the spy, but the properties are only available when the focus is on the context menu.
Please for giving a solution.
Best regards!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3908
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Play Back: Unable to find a submenuItem of context menu

Post by odklizec » Mon Sep 21, 2015 11:15 am

Hi,

I think you should use Instant Tracking (described here). This should help you with tracking popup menu items.

BTW, could you please post your recording (ideally entire project with repository) so we can review your recorded steps and suggest best approach? Please don't forget that after recording some steps, you may still need to review and edit them.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

btonye
Posts: 7
Joined: Thu Jul 02, 2015 11:48 am

Re: Play Back: Unable to find a submenuItem of context menu

Post by btonye » Wed Sep 23, 2015 6:19 pm

thanks for reply.

I've already used instant tracking, the content of the spy is given the same properties, but it 's still failed to find the sub menu item "Copier".

I've find another solution.
I have recently register a seperate test ,and notice that some properties are save differently, In my old repository the property @class was set to value 'XLMAIN' .But in the new repository, it is set to value "Net Ui Tool Window" and it work for me now when i use this value. see image_attachment of the repository view.

Now i' have others problems, sometimes the recording can't execute some actions like:
- moving the gridsplitter to another location
-scrolling over the files with the scrollbar.
The property "Mouse move per action" is well increase at 1000ms .
See the project test as attachement.
Attachments
repository_view.jpg
Repository view
repository_view.jpg (287.3 KiB) Viewed 740 times
projectTest_submenu_gridSplitter_scroll.zip
project test for scrolling and moving gridsplitter
(928.53 KiB) Downloaded 32 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3908
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Play Back: Unable to find a submenuItem of context menu

Post by odklizec » Thu Sep 24, 2015 8:12 am

Hi,

OK, I think you will have to start with smaller steps and always do some clean up after every recording session. You should also split your existing recording to multiple logical (and optimized) recordings. Its not a very good habit to record/add all actions to just one recording. It prevents the reausability of your recordings and you will soon find yourself recording virtually the same actions again and again ;)

At first, as you are already noticed, in the screenshot you uploaded, you have the Copier item in EXCEL base folder, with path like this:
/form[@processname='EXCEL' and @class='XLMAIN']
but in the project you uploaded, the path is like this:
/form[@processname='EXCEL' and @class='Net UI Tool Window']
So the class attribute is apparently different between the excels you are using and this is most probably one of the reasons why the "copy" action fails.

Also the Copier xpath seems to be too complicated and prone to changes. So I would suggest to edit it from this:
?/?/container[@caption='' and @accessiblerole='Pane']/?/?/contextmenu/container[1]/menuitem[@accessiblename='Copier']
to this form:
.//contextmenu/container/menuitem[@accessiblename='Copier']
BTW, what's your actual setting for generating xpaths? I would suggest to use "Reduce" mode...
xpath_gen_reduce.png
xpath_gen_reduce.png (47.43 KiB) Viewed 734 times
As for the other problem with scrolling and dragging sliders, this is unfortunately not something you can easily record and expect it will always work. It's definitely better to add these steps manually, using Mouse Down >> Move >> Mouse Up actions. But even then your actions could easily fail if you run your test on PC with different screen resolution. So using some hardcoded values is not a very good idea.

Instead of dragging the scroll bars by mouse, it's definitely better to find out what's the scroll bar's MaxValue, actual Value and then use SetValue to set new scroll bar position. It's much more reliable than dragging scroll bar. You can do this using Get/SetValue actions and/or some user code.
ScrollBar.png
ScrollBar.png (11.43 KiB) Viewed 734 times
Splitter is unfortunately completely different story and here you may need to use Mouse Down >> Move >> Mouse Up sequence with some hardcoded/calculated position values.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration