title: Selenium Webdriver: How to verify a text that is within h2 and duplicated class
body: <p>I want to locate the <strong>Text</strong> within the below HTML code but there are two duplicated classes.</p>
  
  <pre><code>&lt;div id="header" class="cf"&gt;
  &lt;div class="cf"&gt;
  &lt;h1&gt;
     &lt;a href="/"&gt;Text&lt;/a&gt;
  &lt;/h1&gt;
  </code></pre>
  
  <p>I  located but not sure if that is the best way to do it because the text might `appear some where else.</p>
  
  <pre><code>WebElement LL = driver.findElement(By.linkText("Text"));
  </code></pre>
  
  <p>Anyone have a better way to locate this please? THANK you in advance!</p>