I attempted to create a selenium test that verifies if navigating from one page to another occurs successfully when clicking on buttons. Initially, the test checks if clicking a button on the old page leads to navigation to a new page. Then, it verifies if clicking a button on the new page navigates back to the old page as expected.
Upon executing the test, I encountered an issue where the selenium automation is able to click on the button on the first page and confirm the presence of the button element on the new page. However, when trying to click on the button element on the second page and verifying if the button on the first page reappears, the test fails to locate the button element on the initial page despite using the same button for navigation previously. Even though the first page appears to be loaded, attempts to wait using different statements such as 'waitForPageToLoad()', 'waitForTextPresent("", "text on first page")', or 'waitForElementPresent("" , //path to first button element)' were unsuccessful.
No matter which waiting statement was used, the automation still could not find the button element even though it was identified during the initial loading of the page.