第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Selenium webdriver 不像瀏覽器那樣解釋標記,我不能像瀏覽器那樣加載 DOM

Selenium webdriver 不像瀏覽器那樣解釋標記,我不能像瀏覽器那樣加載 DOM

慕尼黑5688855 2022-12-15 15:21:46
我想使用 java webdriver selenium 在https://appleid.apple.com/中自動執(zhí)行身份驗證過程,但表單的 html 元素未加載到 DOM 中據(jù)我所知,Selenium webdriver 像瀏覽器一樣解釋標記。它應(yīng)用 CSS 樣式,運行 JavaScript 并將動態(tài)呈現(xiàn)的內(nèi)容添加到 DOM為什么 HTML 元素沒有加載到 DOM 中?我該如何繼續(xù),修復(fù)它并加載 DOM 中的所有元素,就像瀏覽器一樣?注意:https ://appleid.apple.com/網(wǎng)站使用 Mustache.JS(無邏輯模板) public static void main(String[] args) {    System.setProperty("webdriver.chrome.driver", "chromedriver.exe");    ChromeOptions options = new ChromeOptions();    options.addArguments("--headless", "--disable-gpu", "--window-size=1920,1200", "--ignore-certificate-errors");    WebDriver driver = new ChromeDriver(options);    driver.get("https://appleid.apple.com/");    waitForPageLoadComplete(driver, 30);    //can't found input name element    WebElement inputName = driver.findElement(By.id("account_name_text_field"));    System.out.println(driver.getPageSource());}
查看完整描述

1 回答

?
慕斯709654

TA貢獻1840條經(jīng)驗 獲得超5個贊

您要查找的元素位于 iFrame 中。您需要先切換到此 iFrame,然后繼續(xù)查找已有的元素。


driver.switchTo().frame("aid-auth-widget-iFrame");


WebElement inputName = driver.findElement(By.id("account_name_text_field"));

您可以在此處找到有關(guān)切換到 iFrame 的一些其他信息: https ://www.guru99.com/handling-iframes-selenium.html


查看完整回答
反對 回復(fù) 2022-12-15
  • 1 回答
  • 0 關(guān)注
  • 112 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號