Screenshot a menu

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 125
Joined: Wed Sep 19, 2018 10:05 am

Screenshot a menu

Post by HansSchl » Fri Aug 07, 2020 3:39 pm

I am preparing a Ranorex repository for use by others. For their convenience, I add screenshots to all repo items.

I created an "app folder" item for a drop-down menu because that is how Ranorex sees it (MFC seems to create its menus directly on the desktop). The path is:

Code: Select all

/form[@processname='<my-app>' and @title='<menu-name> menu']
(I wrote code that supplies the title property) but writing this expression manually gives me no screenshot. Now when I click "Update screenshot" I get the message "Failed to find an element etc.". Sure, the menu is not on the screen when I click elsewhere. In Spy, I can F12-track an item, but that doesn't put a screenshot into the repository. I tried to hold down F12 when I clicked "Update screenshot" but that makes no difference either.

Is there some hidden feature which would do the trick? Or is there a way to import a screenshot from a png file? Or can I import a screenshot created by a "Report" action?

Thank you

User avatar
Posts: 474
Joined: Fri Jul 15, 2016 1:35 pm

Re: Screenshot a menu

Post by Stub » Fri Aug 07, 2020 3:43 pm

I never bothered adding a screenshot to the menu items for our MFC application because, like you, I found it wasn't an easy process. I didn't attempt to find a workaround so I have nothing to suggest I'm afraid. Just joining in so you know you're not the only one!