title: CSS Selector: Anchor text of href contains
body: <p>I am currently working with Selenium and have now reached the interesting, yet incredibly difficult, world of CSS selectors.</p>
  
  <p>I'm currently looking at selecting the different options of the Google tool bar. E.g when you search for something, on the results page you get options to search for the same term but under images, news, videos etc</p>
  
  <p>I'm particularly interested in selecting the "Images" link.</p>
  
  <p>I've been working on it for quite a while and the closest i have got is the below selector:</p>
  
  <pre><code>div a.q.qs[href]
  </code></pre>
  
  <p>This drills down into the right sub classes but there are 16 of them. Despite hours of aimless searching, i'm unable to complete the query with a contains method around the anchor text, which is unique in the targeted sub classes.</p>
  
  <p>I'm aware there is a By LinkText option in Selenium, but i'm not sure if the anchor text is unique across the entire page. Also, i really want to understand CSS selectors in general so even if it was, i want to resolve this particular issue so i can apply it to future problems.</p>
  
  <p>I'm looking for something like the below pseudo CSS selector:</p>
  
  <pre><code>div a.q.qs[href].Anchorcontains("Images")
  </code></pre>
  
  <p>Can anyone help?</p>