Finding specific string in a cell on a grid

Class library usage, coding and language questions.
xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Finding specific string in a cell on a grid

Post by xibinki » Mon Nov 28, 2016 5:41 pm

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

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

Re: Finding specific string in a cell on a grid

Post by odklizec » Mon Nov 28, 2016 6:51 pm

Hi,

Please post a Ranorex snapshot (not screenshot!) of the table in question. Table screenshot is unfortunately not useful here. Thanks.
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

xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Re: Finding specific string in a cell on a grid

Post by xibinki » Tue Nov 29, 2016 10:52 am

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?

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

Re: Finding specific string in a cell on a grid

Post by odklizec » Tue Nov 29, 2016 10:54 am

Hi, you can do it with Instant Tracking, as described here:
http://www.ranorex.com/support/user-gui ... html#c3181
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

xibinki
Posts: 28
Joined: Mon Jun 27, 2016 9:59 am

Re: Finding specific string in a cell on a grid

Post by xibinki » Tue Nov 29, 2016 11:08 am

I tried the Ctrl+Win but I still get the same error: "The selected element is not valid".

Can we skype for remote desktop?

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

Re: Finding specific string in a cell on a grid

Post by odklizec » Tue Nov 29, 2016 11:12 am

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 ;)
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