How can Ranorex interacts with FarPoint control

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
kam
Posts: 10
Joined: Tue Sep 08, 2015 12:08 pm

How can Ranorex interacts with FarPoint control

Post by kam » Thu Mar 24, 2016 11:00 am

Hello,

This is an important part of what to automate on an application under test I'm currently working on. There is a need to interact with field, menu and data on the grid that has FarPoint control in it.

I have initially managed to establish Ranorex interaction using co-ordinate option, but this is not reliable nor stable as a test fails when it runs on different screen dimension.

I also read the previous post on this topic where I found below code I have implemented but didn't work for me.

Code: Select all

public static string[,] GetCellValues(System.Windows.Forms.Control control, object input)
        {
            FarPoint.Win.Spread.FpSpread ssc = (FarPoint.Win.Spread.FpSpread)control;
            FarPoint.Win.Spread.SheetView sv = ssc.ActiveSheet;

            string[,] values = new string[sv.Rows.Count, sv.Columns.Count];

            for (int row = 0; row < sv.Rows.Count; row++)
            {
                for (int col = 0; col < sv.Columns.Count; col++)
                {
                    values[row, col] =
                    sv.Cells[row, col].Value.ToString();
                }
            }

            return values;
        }
        
        public static string[][] getAllSpreadCellValues(Ranorex.Unknown spreadControl)
        {
            Ranorex.Control spread = new Ranorex.Control(spreadControl.Element);
            string[][] cellValues = (string[][])spread.InvokeRemotely(GetCellValues);

            return cellValues;
        }
With above code, i got below error:

{Ranorex.ActionFailedException: Action 'invokeremotely' failed on element '{Unknown:dataSpread}'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Ranorex.Plugin.WinFormsFlavorElement.InvokeRemotely(RemotelyInvokedDelegate deleg, Object inputData, Duration timeout)
at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args)
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
--- End of inner exception stack trace ---
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
at Ranorex.Control.InvokeRemotely(RemotelyInvokedDelegate deleg, Object inputData, Duration timeout)
at Ranorex.Control.InvokeRemotely(RemotelyInvokedDelegate deleg, Object inputData)
at Ranorex.Control.InvokeRemotely(RemotelyInvokedDelegate deleg)
at HubbleDesktopAutomation.ColumnsDefinitionVirtualViews.getAllSpreadCellValues(Unknown spreadControl) in c:\Users\kamoru.tiamiyu\Source\Workspace\InquirySuite\IS9.x\Hubble Desktop Automation\HubbleDesktopAutomation\MethodsController\VirtualView\ColumnsDefinitionVirtualViews.cs:line 192
at HubbleDesktopAutomation.ColumnsDefinitionVirtualViews.ChangeColumnDefinition(String columnName, String columnDefinition) in c:\Users\kamoru.tiamiyu\Source\Workspace\InquirySuite\IS9.x\Hubble Desktop Automation\HubbleDesktopAutomation\MethodsController\VirtualView\ColumnsDefinitionVirtualViews.cs:line 38}

Please find the snapshot attached.
Attachments
FarPoint controls snapshot.rxsnp
(195.24 KiB) Downloaded 46 times

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

Re: How can Ranorex interacts with FarPoint control

Post by odklizec » Thu Mar 24, 2016 12:31 pm

Hi,

It seems the FarPoint control used in your app is implemented without UI automation/accessibility in mind. There are some workarounds you may try, but some of them may require advanced dev. skills and deep knowledge of things like subclassing.

The easiest workaround you can try is something called GDI Capture List (described >here<). Unfortunately, this solution is not suitable for complex controls (like grids/tables). The more complex the control is, the more custom code you will have to write to get results you are looking for. Sometimes, it's better to give up and use image validation instead ;)

Another possibility might be using InvokeRemotely, deeply described here:
http://www.ranorex.com/blog/transfering ... et-control
FarPoint related discussion can be found here (but without entire solution):
http://www.ranorex.com/forum/receiving- ... t2056.html
Search also all InvokeRemotely-related posts at forum.

And last thing you can try is to implement your own accessibility layer to this element (this might be pretty complicated stuff)...
http://www.ranorex.com/blog/enabling-au ... -controls/

Good luck!
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

kam
Posts: 10
Joined: Tue Sep 08, 2015 12:08 pm

Re: How can Ranorex interacts with FarPoint control

Post by kam » Tue Mar 29, 2016 9:13 am

Thanks for your support odklizec. Unfortunately, I tried a number of suggestions you posted but have not got the solution to it.

@Ranorex support team, any suggestions?

Regards,
Kam

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How can Ranorex interacts with FarPoint control

Post by Support Team » Wed Mar 30, 2016 1:36 pm

Hello Kam,

I'm afraid to tell you that the only reliable way to recognize those UI elements would be implementing the accessibility like already mentioned by odklizec.

Detailed information about implementing accessibility for Windows Forms controls can be found in our blog.

In order to rule out that the issue is caused by Ranorex, please try tracking the elements with Microsoft Inspect. The data view shows the property information of the UI element that is currently selected. Generally, Ranorex accesses the same accessibility information from the application under test as Microsoft Inspect. If Microsoft Inspect behaves the same as Ranorex Spy, I’m sorry to tell you that the issue is not related to Ranorex but to the accessibility of the application under test.

Microsoft Inspect is part of the Windows SDK (Software Development Kit).
More information about this tool can be found at the microsoft webpage.

If you need more information, please do let me know.

Sincerely,
Johannes
.
Image