How can Ranorex interacts with FarPoint control
Posted: 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.
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.
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;
}
{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.