![](/img/trans.png)
[英]Not able to find any elements identified on the webpage after the InternetExplorer browser is launched through Selenium Webdriver
[英]Selenium cant access any elements on the webpage
我正在使用 Specflow 和 Nunit 在 C# 中為我正在處理的一個新項目編寫 Selenium 測試,我正在處理的新項目中, body
內部的任何東西都無法在任何地方選擇
我可以訪問身體
WaitUntil(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("body")));
但不能進行以下工作和 throe element not found 異常:
WaitUntil(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("halo-root")));
WaitUntil(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("halo-entry")));`
WaitUntil(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("halo-navigation-container")));
ETC
錯誤:沒有這樣的元素:無法找到元素:{“method”:“css selector”,“selector”:“halo-root”}
ElementIsVisible
, ElementIsClickable
等所有幫助表示贊賞
ps 無法共享整個 SUT,因為它需要 vpn 訪問。
首先檢查您的 html。 我認為身體標簽必須存在於iframe中。 如果它存在於 iframe 中,首先切換到 iframe 然后嘗試對元素執行任何命令(等待或操作)。
問題是通過門戶(Jumpcloud)登錄時打開了一個新選項卡(我沒有注意到)所以解決方案只是切換到新的 window 與_driver.SwitchTo().Window(_driver.WindowHandles[1])
感謝所有的幫助::)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.