Page 1 of 1

Play Back: Unable to find a submenuItem of context menu

Posted: Mon Sep 21, 2015 10:07 am
by btonye
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!

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

Posted: Mon Sep 21, 2015 11:15 am
by odklizec
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.

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

Posted: Wed Sep 23, 2015 6:19 pm
by btonye
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.

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

Posted: Thu Sep 24, 2015 8:12 am
by odklizec
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
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
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.