title: How to find a grid element by content, rather than grid number in selenium
body: <p>I have a website in which the grid numbers don't match up with the shown primary key.
  For example, the key will tell the user that an element in the table is number 42, when it's only the 30th element in the grid, due to permission-based number skipping.
  What is the best way to select based on the primary key, rather than the grid number in selenium?</p>
  
  <p>Clarification:
  say my grid looks like this:
  <code>
  6   Ice Cream
  11  Hot Dog
  24  Cheeseburger
  25  Double Cheeseburger
  26  Salad
  </code></p>
  
  <p>Ice cream can be selected through 
  <code>driver.findElement(By.xpath("//*grid-0");</code>
  Hot Dog = grid-1
  etc...</p>
  
  <p>What would be the best way to select icecream by the contents of its key (6) instead?</p>
  
  <p>I can iterate through the entire grid using </p>
  
  <pre><code>driver.findElement(By.xpath("//*grid-0")).getText().contains("6");
  </code></pre>
  
  <p>but then I have the issue of locating every element with a 6 in it, instead of just ice cream, and I have to traverse the entire page to find it, which is really inefficient. </p>
  
  <p>Any ideas?</p>