I would make use of the TryFindSingle method, described in the Ranorex documentation
found here
In your case, I would enter the Table object into a repository, make it a variable in user code and then call the TryFindSingle method on it. I would then make the attribute used inside of the xpath a variable.
Like so:
var repo = myRepo.Instance;
var table = repo.myTable;
string myAttribute = "test";
bool controlFound;
SpanTag control = null;
controlFound = table.TryFindSingle<SpanTag>(String.Format("//span[@innertext='" + myAttribute + "']"), out control);
if(control != null)
control.Click();
Obviously you could substitute certain parts of the code to meet your needs, but looking at your screenshots and your post I assumed you wanted a Span tag with a certain innertext that you specify.
Additionally, if you wanted to make sure that the cell you find is found within a specific column, I would use an 'and' operator in the x-path and pass the childIndex that corresponds to the column.
Say for instance all values found in the 'Absender' column were the third child of the table row:
Code: Select all
"//span[@innertext='" + myAttribute + "' and @childIndex='3']"