title: Select an element by the text it contains with Selenium Webdriver
body: <p>I've jjust started off with Selenium Webdriver and I've hit an issuee straight away involving the buttons I'm trying to select/click all have no IDs and share the same class. </p>
  
  <p>So I'm wondering how I select these by the unique text they contain.</p>
  
  <p>I'm thinking possibly with css selector maybe, but I'm unsure how to also tell it to look for specific text to select the element.</p>
  
  <p>All I currently have is:</p>
  
  <pre><code>using OpenQA.Selenium;
  using OpenQA.Selenium.Firefox;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using OpenQA.Selenium.Internal;
  
  namespace SeleniumTest1.Methods
  {
      public class HomePage
      {
  
          private readonly IWebDriver _browser;
          public HomePage(IWebDriver browser)
          {
              _browser = browser;
          }
  
          public IWebElement SearchBox()
          {
              return _browser.FindElement(By.Id("searchBox"));
          }
  
          public void ImageButton()
          {
              _browser.FindElement(By.CssSelector("a")).Click();
          }
  
      }
  }
  </code></pre>
  
  <p>Very basic so far.</p>
  
  <p>Where I have the CssSelector I'm not sure if theres anyway to say select "a" containing text "xyz".</p>
  
  <p>I've tried search for ways but can't find anything, though I  feel this must be an issue which has been raised before, thanks. </p>