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:元素在緩存中沒有發現 - 也許是頁面已經改變,因爲它看起來向上。
預期結果:按鈕應該獲得點擊
實際結果:收到一條錯誤消息。