久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

org.openqa.selenium.NoSuchElementException:嘗試通過 CssSe

org.openqa.selenium.NoSuchElementException: Returned node (null) was not a DOM element when trying to locate card-fields-iframe by CssSelector(org.openqa.selenium.NoSuchElementException:嘗試通過 CssSelector 定位 card-fields-iframe 時返
本文介紹了org.openqa.selenium.NoSuchElementException:嘗試通過 CssSelector 定位 card-fields-iframe 時返回的節點(null)不是 DOM 元素的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試通過部分 id 定位 iframe.對于這種方法,我使用了:driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[id*='card-fields-number']"))); 我也試過xpath.

 driver.switchTo().frame(driver.findElement(By.xpath("http://iframe[contains(@id,'card-fields-number')]")));

但是,我仍然收到此異常:

org.openqa.selenium.NoSuchElementException: 返回的節點(null)不是 DOM 元素

我發現當我為 HtmlUnit 啟用 javascript 時,它能夠找到框架并切換到它.我寧愿不啟用 javascript,因為它對我來說運行速度非常慢,并增加了不必要的延遲.

iFrame HTML 代碼: