How to identify MFC application buttons

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
mohan.pentyala
Posts: 14
Joined: Thu Sep 20, 2018 7:43 am

How to identify MFC application buttons

Post by mohan.pentyala » Thu Sep 20, 2018 7:47 am

Hi Team ,

I am working on a MFC application and trying to identify a button on the header , which i am not able to .When i track it through spy it is identifying as complete toolbar instead of single button ,

I have tried adding GDi capture list as well but still i am not able to , Can you please help me with this ?
Attachments
MFC.png
MFC.png (96.01 KiB) Viewed 124 times

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

Re: How to identify MFC application buttons

Post by odklizec » Thu Sep 20, 2018 11:39 am

Hi,

It's hard to suggest something reliable, without seeing the app under test (AUT) or at very least Ranorex snapshot (which I think would be useless this time). Sadly, if GDI capture list does not return rawtexts for individual buttons, there is probably not much else you can try. Your only hope is screenshot-based automation, which is unfortunately not very reliable in a long-term run. Another possibility is a proper implementation of MSAA, which must be done by the AUT developers.
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

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

Re: How to identify MFC application buttons

Post by Stub » Thu Sep 20, 2018 2:21 pm

I have a similar controls in our Windows desktop MFC application. Individual text items appear in the control and I simply must use GDICapture for exactly this circumstance. The rawtext elements are absolutely critical to my being able to automate these individual controls which feature a decent bit of text.

However, we also have icon buttons in some places, and these are toggleable. To control these I've had to resort to finding the control by image comparison. I saved a compact bitmap image of the control and search for that to find an area I can click on to toggle state. It's not great, I know, but it's worked well here for the past 2y or so through Ranorex v6, v7 and now v8.

mohan.pentyala
Posts: 14
Joined: Thu Sep 20, 2018 7:43 am

Re: How to identify MFC application buttons

Post by mohan.pentyala » Thu Sep 20, 2018 2:43 pm

Hi ,

Thank you for the reply , Please find the atatched snapshot of my application , Can you check and help me if i can do from my end aprt from screen shot based automation
odklizec wrote:
Thu Sep 20, 2018 11:39 am
Hi,

It's hard to suggest something reliable, without seeing the app under test (AUT) or at very least Ranorex snapshot (which I think would be useless this time). Sadly, if GDI capture list does not return rawtexts for individual buttons, there is probably not much else you can try. Your only hope is screenshot-based automation, which is unfortunately not very reliable in a long-term run. Another possibility is a proper implementation of MSAA, which must be done by the AUT developers.

mohan.pentyala
Posts: 14
Joined: Thu Sep 20, 2018 7:43 am

Re: How to identify MFC application buttons

Post by mohan.pentyala » Thu Sep 20, 2018 2:46 pm

Thank you for the reply ,

Can you please share any blogs or link which i can go through for bitmap image based automation

Stub wrote:
Thu Sep 20, 2018 2:21 pm
I have a similar controls in our Windows desktop MFC application. Individual text items appear in the control and I simply must use GDICapture for exactly this circumstance. The rawtext elements are absolutely critical to my being able to automate these individual controls which feature a decent bit of text.

However, we also have icon buttons in some places, and these are toggleable. To control these I've had to resort to finding the control by image comparison. I saved a compact bitmap image of the control and search for that to find an area I can click on to toggle state. It's not great, I know, but it's worked well here for the past 2y or so through Ranorex v6, v7 and now v8.

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

Re: How to identify MFC application buttons

Post by odklizec » Fri Sep 21, 2018 7:29 am

mohan.pentyala wrote:
Thu Sep 20, 2018 2:43 pm
Hi ,

Thank you for the reply , Please find the atatched snapshot of my application , Can you check and help me if i can do from my end aprt from screen shot based automation
I'm afraid, there seems to be no snapshot attached to your post. But to be quite honest, I doubt the snapshot will be useful in this particular case. And if adding parent control (or entire form) to GDI capture did not help with extracting RAW texts, there is most probably nothing you can do, except using screenshot-based automation. Definitely nothing without the help of app developers and implementing proper accessibility support.
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

mohan.pentyala
Posts: 14
Joined: Thu Sep 20, 2018 7:43 am

Re: How to identify MFC application buttons

Post by mohan.pentyala » Tue Sep 25, 2018 5:31 am

HI ,

Yes as you said i was discussing with my Team , to make sure I am attaching my snapshot as well . Can you please have a look and help me if we can do anything else .

Sure attached the snapshot this time :)
Application.rxsnp
(104.37 KiB) Downloaded 3 times

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

Re: How to identify MFC application buttons

Post by odklizec » Tue Sep 25, 2018 8:02 am

Hi,

At first, there is issued a technology limitation warning in the snapshot you posted. Which means the Ranorex element identification capabilities are limited for your app. So you should fix this problem first. Follow the steps mentioned here:
https://www.ranorex.com/help/latest/int ... plications
BTW, have you tried to run both Ranorex Studio/Spy as Administrator?

At second, after the above problem is cleared (and Ranorex is still not able to extract buttons from toolbar), try to add the parent form to GDI capture list...
GDICaptureList.png
GDICaptureList.png (20.41 KiB) Viewed 85 times
Then refresh the Spy and see, if there are any raw texts available in the UI tree. These should help you with identification of the toolbar buttons (texts). If there are no raw texts, then I'm afraid, screenshot-based automation is your only hope. Either this, or the application developers must properly implement msaa.
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

mohan.pentyala
Posts: 14
Joined: Thu Sep 20, 2018 7:43 am

Re: How to identify MFC application buttons

Post by mohan.pentyala » Wed Sep 26, 2018 10:22 am

Hi ,

Thanks for the help .Though i added to GDI capture list still i didn't see any raw text for the buttons .i will discuss with developer to place proper ID for the same.