需要:使用 Selenium 更新 url 上的字段并單擊按鈕(下面是網頁和 HTML 詳細信息的屏幕截圖)問題:返回錯誤,如下所示錯誤:Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable(Session info: chrome=78.0.3904.70)研究:我參考了以下內容但無法修復它 - Link1 Link2代碼:根據其他鏈接中的建議添加了等待和睡眠,但仍然不起作用。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("[email protected]");HTML 和網頁視圖: 鏈接希望所面臨的問題是清楚的,等待指導。
1 回答

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