Method click without coordinates

Ask general questions here.
antonandreev84
Posts: 6
Joined: Fri Mar 17, 2017 3:06 pm

Method click without coordinates

Post by antonandreev84 » Sat Mar 18, 2017 3:36 pm

Dear all!
Please answer the question, how do I call method click() for the elements of control without screen coordinates, for example, TMFDockForm, shown in the figure.
Now I have code
repo.MainForm.MFDockForm.Click('23:130'); And I have a problem how call click of button of nfdockform without coordinates.
Thank you in advance!
Ranorex Version 5.4, Codegear Delphi XE3, Windows 10 64bit,
10.0.14393
You do not have the required permissions to view the files attached to this post.
Last edited by antonandreev84 on Mon Mar 20, 2017 9:22 am, edited 1 time in total.

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

Re: Method click without coordinates

Post by odklizec » Mon Mar 20, 2017 9:05 am

Hi,

Unfortunately, there is not enough information in your post to provide a reasonable answer. Please answer the following questions:
Ranorex version?
Used GUI technology (.net, mfc, something 3rd party e.g. devexpress,...)?
Please post a Ranorex Snapshot (not screenshot) of the problematic toolbar.

Generally speaking, if I understand your problem correctly, you want to click a button in the toolbar? But if the individual buttons are not recognizable by Ranorex (either via spy or tracking), this is why there are used coordinates to click in toolbar. Basically, if Ranorex don't recognize individual buttons, it simply clicks at given position within the toolbar frame. Unfortunately, without knowing more about the problematic toolbar (used technology, small demo app), it's hard to say if there is a way to make Ranorex to recognize the individual buttons. How I see it, your only hope is most probably using image recognition.
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: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: Method click without coordinates

Post by Stub » Mon Mar 20, 2017 9:19 am

On a toolbar with no Ranorex recognisable elements I ended up loading an image of the button I wanted to be clicked upon and then I called Click by passing a new Location object with the loaded bitmap image.

antonandreev84
Posts: 6
Joined: Fri Mar 17, 2017 3:06 pm

Re: Method click without coordinates

Post by antonandreev84 » Mon Mar 20, 2017 9:31 am

Hi,
My problem is that the button is pressed in the test, no matter what new coordinates, for example, when the toolbar is moved. In Ranorex Spy buttons not recognized. About System i answered above.
odklizec wrote:Hi,

Unfortunately, there is not enough information in your post to provide a reasonable answer. Please answer the following questions:
Ranorex version?
Used GUI technology (.net, mfc, something 3rd party e.g. devexpress,...)?
Please post a Ranorex Snapshot (not screenshot) of the problematic toolbar.

Generally speaking, if I understand your problem correctly, you want to click a button in the toolbar? But if the individual buttons are not recognizable by Ranorex (either via spy or tracking), this is why there are used coordinates to click in toolbar. Basically, if Ranorex don't recognize individual buttons, it simply clicks at given position within the toolbar frame. Unfortunately, without knowing more about the problematic toolbar (used technology, small demo app), it's hard to say if there is a way to make Ranorex to recognize the individual buttons. How I see it, your only hope is most probably using image recognition.

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

Re: Method click without coordinates

Post by odklizec » Mon Mar 20, 2017 9:36 am

Thanks for additional details. OK, Ranorex 5.4 is quite old, but this time, upgrading to newest version will not help anyway ;) I'm afraid, there is not much that can be done for Delphi controls, not to mention 3rd-party Delphi controls. The only thing what you can probably try is to switch the Delphi support (in Ranorex settings >> Plugins >> Win32 section) to opposite state of what you currently have set. But I guess that image recognition will be the only way to go. For more details about Ranorex imaging capabilities, check this screencast:
http://www.ranorex.com/support/screencasts.html#c2529

Image-based automation chapter in Ranorex user guide:
http://www.ranorex.com/support/user-gui ... ation.html

And also this blog post:
http://www.ranorex.com/blog/enhanced-fe ... alidation/
Last edited by odklizec on Mon Mar 20, 2017 9:38 am, edited 1 time in total.
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

antonandreev84
Posts: 6
Joined: Fri Mar 17, 2017 3:06 pm

Re: Method click without coordinates

Post by antonandreev84 » Mon Mar 20, 2017 9:38 am

How does the pattern recognition work? Where about him you can read? Thanks for the help! :D
odklizec wrote:Thanks for additional details. OK, Ranorex 5.4 is quite old, but this time, upgrading to newest version will not help anyway ;) I'm afraid, there is not much that can be done for Delphi controls, not to mention 3rd-party Delphi controls. The only thing what you can probably try is to switch the Delphi support (in Ranorex settings >> Plugins >> Win32 section) to opposite state of what you currently have set. But I guess that image recognition will be the only way to go.

antonandreev84
Posts: 6
Joined: Fri Mar 17, 2017 3:06 pm

Re: Method click without coordinates

Post by antonandreev84 » Mon Mar 20, 2017 9:40 am

Hi, thanks for help :D , Can you tell us in more detail? Or where you can read about this as it is done in practice?
Stub wrote:On a toolbar with no Ranorex recognisable elements I ended up loading an image of the button I wanted to be clicked upon and then I called Click by passing a new Location object with the loaded bitmap image.

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Method click without coordinates

Post by qwertzu » Mon Mar 20, 2017 12:52 pm

Hi antonandreev,

You can try to add the process of your application to the GDI Capture List and see whether this would help identifying the elements. Therefore simply right click on the Form element and choose "Add Process Name to GDI Capture List" (See Screenshot)

If this does not work, you can try to use image based automation, as odklizec already suggested.

I hope, this will help.

regards,

qwertzu
You do not have the required permissions to view the files attached to this post.

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

Re: Method click without coordinates

Post by Stub » Wed Mar 22, 2017 10:06 am

antonandreev84 wrote:Hi, thanks for help :D , Can you tell us in more detail? Or where you can read about this as it is done in practice?
Stub wrote:On a toolbar with no Ranorex recognisable elements I ended up loading an image of the button I wanted to be clicked upon and then I called Click by passing a new Location object with the loaded bitmap image.
I do something along these lines which has worked well for me thus far:

Code: Select all

Bitmap bmp = Ranorex.Imaging.Load("BitmapFilename.bmp"));
            
Report.Log(ReportLevel.Info, "Mouse", "Blah de blah.\r\nMouse Left Click loaded bitmap image.");
Report.LogData(ReportLevel.Info, "Item to click upon", bmp);

AUT.RepositoryItem.Self.Click(new Location(bmp, new Imaging.FindOptions(0.9)));
This is detailed here. HTH.