1
关于我以前的question,我无法返回到Iframe模式关闭后的初始页面。C#Selenium:无法返回初始页面
我试图用
driver.SwitchTo().DefaultContent();
string currentWindow = driver.CurrentWindowHandle; //called before iframe modal popup window is called to open.
driver.SwitchTo().Window(currentWindow);
,但没有这样做,收到错误:----> OpenQA.Selenium.StaleElementReferenceException:元素在缓存中没有发现 - 也许是页面已经改变,因为它看起来向上。
预期结果:按钮应该获得点击
实际结果:收到一条错误消息。