Page 1 of 1

Finding specific string in a cell on a grid

Posted: Mon Nov 28, 2016 5:41 pm
by xibinki
Hi,

I'm trying to code a method, in order to, find a specific string in a cell.
I've searched on the forum and I came accross this method:

Code: Select all

		public void findingCell()
		{
			repo.BO.SIGABOClient.NewSupplierInvoice.BtnLocalEntrega.Click();
			
			IList<Row> rowList = repo.BO.GenericChooserWorkaroundForDesigner.TableInst.FindDescendants<Row>();
			foreach(Row rowItem in rowList){
				Report.Info("Row index: "+rowItem.Index);
				IList<Cell> cellList = rowItem.Cells;
				foreach(Cell cellItem in cellList){
					Report.Info("Cell Info: "+cellItem.Text);
				}
			}
		}
But I'm getting a strange result, on my report it displays the correct number of rows and cells that my table has, but all the cells are displayed as empty, example:

Code: Select all

00:09.640 Info User 

 Row index: 0  
00:09.687 Info User 

 Cell Info:  
00:09.687 Info User 

 Cell Info:  
00:09.703 Info User 

 Cell Info:  
00:09.703 Info User 

 Cell Info:  
00:09.718 Info User 

 Cell Info:  
00:09.734 Info User 

 Cell Info:  
00:09.734 Info User 

 Row index: 1  
00:09.765 Info User 

 Cell Info:  
00:09.828 Info User 

 Cell Info:  
00:09.828 Info User 

 Cell Info:  
00:09.843 Info User 

 Cell Info:  
00:09.843 Info User 

 Cell Info:  
00:09.859 Info User 

 Cell Info:  
00:09.859 Info User 

 Row index: 2  
00:09.890 Info User 

 Cell Info:  
00:09.890 Info User 

 Cell Info:  
00:09.906 Info User 

 Cell Info:  
00:09.906 Info User 

 Cell Info:  
00:09.922 Info User 

 Cell Info:  
00:09.922 Info User 

 Cell Info:  
I added the "TableInst" to Ranorex repository using the SpyTool, but I noticed that it only added a single element of the table and under SpyTool, my table has a lot of children. I'm suspecting that the empty result it's because the method can't actually navigate into the cells information (elements).

Question: How can I find a specific string on a specific column index (1) through the method I just mentioned and then select/click on that row?

I'll leave a screenshot of my grid:
Image

Re: Finding specific string in a cell on a grid

Posted: Mon Nov 28, 2016 6:51 pm
by odklizec
Hi,

Please post a Ranorex snapshot (not screenshot!) of the table in question. Table screenshot is unfortunately not useful here. Thanks.

Re: Finding specific string in a cell on a grid

Posted: Tue Nov 29, 2016 10:52 am
by xibinki
I'm having trouble saving the snapshot, because the window where the grid opens, closes automatically when it loses focus (it's how the application is coded) and when I try to save the snapshot, it tells me "The selected element is not valid anymore", which makes sense because the window already closed.

How can I... take the snapshot in these conditions?

Re: Finding specific string in a cell on a grid

Posted: Tue Nov 29, 2016 10:54 am
by odklizec
Hi, you can do it with Instant Tracking, as described here:
http://www.ranorex.com/support/user-gui ... html#c3181

Re: Finding specific string in a cell on a grid

Posted: Tue Nov 29, 2016 11:08 am
by xibinki
I tried the Ctrl+Win but I still get the same error: "The selected element is not valid".

Can we skype for remote desktop?

Re: Finding specific string in a cell on a grid

Posted: Tue Nov 29, 2016 11:12 am
by odklizec
Hi,

I'm sorry, but I can't do remote session/skype. Please contact Ranorex folks about this ([email protected]). I'm just a regular Ranorex user like you and I'm afraid, I don't have time for remote support sessions ;)