Page 1 of 1
Unable to recognize element in grid
Posted: Wed Jan 18, 2012 8:01 pm
by pksy
Hi,
I've been using RanorexSpy for a while and I've been able to successfully track elements. But there's on part of my application where it can't seem to recognize the columns/rows in a grid. I can only seem to recognize the whole grid as a whole and RanorexSpy sees this grid as a "Janus.Windows.GridEX.GridEX".
I've searched through forums regarding this and is my issue similar to issues people have where the solution is to use InvokeRemotely? If so, is there a tutorial for beginners regarding on how to use InvokeRemotely for a Janus.Windows.GridEX.GridEX?
Thanks
PS
Re: Unable to recognize element in grid
Posted: Thu Jan 19, 2012 10:17 am
by Support Team
Hi,
Please take a look to following blog
http://www.ranorex.com/blog/transfering ... et-control
Regards,
Peter
Ranorex Team
Re: Unable to recognize element in grid
Posted: Fri Jan 20, 2012 7:53 pm
by pksy
I'm fairly new regarding this so please bear with me. In the link you provided, it's trying to get items from a ListView so it uses the following:
System.Windows.Forms.ListView remoteListView = (System.Windows.Forms.ListView)control;
For my case, would it be the following?
Janus.Windows.GridEX.GridEX grid = (Janus.Windows.GridEX.GridEX)control;
Thanks
Re: Unable to recognize element in grid
Posted: Mon Jan 23, 2012 12:35 pm
by Support Team
Hi,
Please take another look to this post. There will be explained how you use the invoke.
http://www.ranorex.com/forum/invokeremo ... t1002.html
Regards,
Peter
Ranorex Team
Re: Unable to recognize element in grid
Posted: Thu Feb 02, 2012 12:13 am
by pksy
I've made a lot of progress regarding this. So far I'm able to find a specific cell with a specific name. The part I'm stuck on is how do I right click that cell since I can't seem find such a command with GridEX. Or is there a way to convert a GridEXcell to a Ranorex.Cell?
I've copied and pasted my code below. I keep on getting the "Object reference not set to an instance of an object" error message.
***************
Ranorex.Control gridTest = repo.File_Window.Tab.File_Task_GridInfo.AbsolutePath.ToString();
Ranorex.Cell task = (Ranorex.Cell)gridTest.InvokeRemotely(GetDelegate);
task.Click(WinForms.MouseButtons.Right);
static object GetDelegate(System.Windows.Forms.Control control, object input)
{
GridEX grid = (control as GridEX);
grid.ExpandRecords();
GridEXRow parentRow = grid.GetRow();
GridEXRow[] childrenRow = parentRow.GetChildRows();
GridEXCellCollection cell = childrenRow[0].Cells;
foreach (GridEXCell item in cell)
{
if(item.Text == "some text")
{
return.item;
}
}
return null;
}
Re: Unable to recognize element in grid
Posted: Mon Feb 06, 2012 1:51 pm
by Support Team
Hi,
basically as described in
this blog post only primitive types can be returned using InvokeRemotely.
So, you have to perform the click action within your method.
Therefore please have a look at the GridEXCell documentation.
Regards,
Tobias
Ranorex Support Team