title: Same XPath for two elements on two different pages. How to access them using Selenium WebDriver in Java?
body: <p>I'm trying to verify page header titles on two different pages.</p>
  
  <ol>
  <li>Accessing the site and verifying the page header title.</li>
  <li>Entering an input in text field and clicking on submit button.</li>
  <li>Verifying the page header title </li>
  </ol>
  
  <p>Page from step 1 and step 3 has same <code>xpath</code> for header titles, when I'm trying to access and verify, I get an error message:</p>
  
  <blockquote>
    <p>expected(expected title) but found(unexpected title)</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>/html/body/div[4]/div/div[1]/div/h1/span
  /html/body/div[4]/div/div[1]/div/h1/span
  </code></pre>
  
  <p>Screenshots for HTML Code : </p>
  
  <p><a href="https://i.stack.imgur.com/tf6hA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tf6hA.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/9wENO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9wENO.png" alt="enter image description here"></a></p>