需要:使用 Selenium 更新 url 上的字段并單擊按鈕(下面是網(wǎng)頁和 HTML 詳細(xì)信息的屏幕截圖)問題:返回錯誤,如下所示錯誤:Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable(Session info: chrome=78.0.3904.70)研究:我參考了以下內(nèi)容但無法修復(fù)它 - Link1 Link2代碼:根據(jù)其他鏈接中的建議添加了等待和睡眠,但仍然不起作用。WebDriver driver = new ChromeDriver();driver.get(url);WebElement email = driver.findElement(By.xpath("//label[contains(text(),'User ID')]"));WebElement password = driver.findElement(By.xpath("//label[contains(text(),'Password')]"));new WebDriverWait(driver,20); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); }email.sendKeys("myemail@gmail.com");HTML 和網(wǎng)頁視圖: 鏈接希望所面臨的問題是清楚的,等待指導(dǎo)。
1 回答

慕娘9325324
TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個贊
請嘗試以下任一 xpath
//label[contains(text(),'User ID')]/following-sibling::input
//input[@placeholder='User ID']
你的 xpath 正在定位標(biāo)簽。你需要找到<input>
添加回答
舉報
0/150
提交
取消