title: Find element with selenium by display text
body: <p>I am trying to hover over an element in a menu bar with selenium, but having difficulty locating the element. The element is displayed below :</p>
  
  <pre><code>&lt;DIV onmouseover="function(blah blah);" class=mainItem&gt;TextToFind&lt;/DIV&gt;
  </code></pre>
  
  <p>There are multiple elements of this type so I need to find this element by <code>TextToFind</code>.</p>
  
  <p>I've tried :</p>
  
  <pre><code>driver.FindElement(By.XPath("TextToFind"))
  </code></pre>
  
  <p>and </p>
  
  <pre><code>driver.FindElement(By.LinkText("TextToFind")) 
  </code></pre>
  
  <p>which both didn't work. I even tried:</p>
  
  <pre><code>driver.FindElement(By.ClassName("mainItem")) 
  </code></pre>
  
  <p>which also did not work. Can someone tell me what I am doing incorrectly?</p>