[英]How to overcome the “element not interactable exception”
I have tried double click method, Thread.sleep, implicit wait, explicit wait(both before and after the element), used xpath, css locators but I still get the org.openqa.selenium.ElementNotInteractableException: element not interactable exception. 這是最新版本的代碼;
//selecting student information tab
driver.findElement(By.cssSelector("div.mat-tab-labels>div:nth-child(2)")).click();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
//enter lastname
// try {
// new
WebDriverWait(driver,10).until(ExpectedConditions.elementToBeClickable(By.cssSelector("ms-text-
field[placeholder='GENERAL.FIELD.LAST_NAME']"))).click();
// driver.findElement(By.cssSelector("ms-text-
field[placeholder='GENERAL.FIELD.LAST_NAME']")).sendKeys("Abuzer");
// } catch (Exception e){}
WebElement lname = driver.findElement(By.xpath("//ms-text-field[@formcontrolname='lastName']"));
lname.click();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
lname.sendKeys("John");`
我還分享了對我不起作用的評論部分。
您是否檢查了 iframe 的存在?
在您使用“Xpath”的最后一次測試中,如果您針對輸入元素而不是 ms-text-field 會發生什么? 就像是:
WebDriverWait(driver,10).until(ExpectedConditions.elementToBeClickable(By.xpath("//ms-text-field[@formcontrolname='lastName']/input"))).click();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.