mardi 2 août 2016

Selenium FindElement() finds elements on previous page

Im testing a perl website in IE11.

In the test, I find an element in the menu bar using FindElement(), then click the element which changes the view of the site. This obviously comes with a change in the html source code. However, when I try to find the next item to click on the page, it does not work.

By using Debug.WriteLine(driver.FindElement(By.TagName("html")).GetAttribute("innerHTML"));, I am able to see that selenium is still searching the previous page for the element I need, which does not exist on that page.. Is there a way that I can fix this issue?

Ive tried

wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.XPath("//html/frameset")));

and

wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt("ipsm_content_frame"));

Both timed out after 10 seconds, even though the page has loaded and even used a hard wait to wait for selenium to find the new document.

Ive also tried using

driver.Navigate().Refresh();

but a refresh on this specific webpage takes me back to the main page of the website..

Aucun commentaire:

Enregistrer un commentaire