title: Cannot find element after page refreshed - Selenium
body: <p>I wanted to run a selenium test that checks whether it navigates to a new page when the button in the old page is clicked. Then I wanted to test whether it navigates back to the old page when the button in the new page is clicked. </p>
  
  <p>The test works correctly when i click on the button on the first page and check whether the button element on the new page appears. But when i use selenium to click on the button element on the second page and check if the button element on the first page has appeared, it fails to find the button element on the first page, although i used the same button element to go the second page the first time and i can see that the first page is loaded. i tried usign the following wait statements: </p>
  
  <pre><code> waitForPageToLoad()
   waitForTextPresent("", "text on first page")
   waitForElementPresent("" , //path to first button element)
   WebElement element = (new WebDriverWait(driver,      10)).until(ExpectedConditions.elementToBeClickable(By.xpath("path to first button elment")));
  </code></pre>
  
  <p>None of the above wait statements work although the same element was found when the page was first initialized.</p>