In my selenium test I get an error: OpenQA.Selenium.StaleElementReferenceException: 'stale element reference: element is not attached to the page document'
In this code(error picture):
public bool TrySwitchToIframeWithChild(By childBy)
{
IWebElement el;
if (TryFindElement(childBy, out el))
return true;
IReadOnlyCollection<IWebElement> frames = Driver.FindElements(By.TagName("iframe"));
foreach (var frame in frames)
{
Driver.SwitchTo().Frame(frame);
if (TrySwitchToIframeWithChild(childBy))
return true;
}
Driver.SwitchTo().DefaultContent();
return false;
}
Line Driver.SwitchTo().Frame(frame); have an error, may be someone know how it is possible to upgrade the code?
Aucun commentaire:
Enregistrer un commentaire