How to resolve ElementNotInteractableException: Element is not visible in Selenium webdriver?

前端 未结 5 1337
春和景丽
春和景丽 2020-11-21 13:53

Here I have the image of my code and the image of my error. Can anyone help me to resolve this issue?

5条回答
  •  后悔当初
    2020-11-21 14:21

    This Exception we get when the element is not in an interactable state. So we can use wait till the element is Located or become clickable.

    1. Try using the Implicit wait:

      driver.manage().timeouts().implicitlyWait(Time, TimeUnit.SECONDS);
      
    2. If this is not working use Explicit wait:

      WebDriverWait wait=new WebDriverWait(driver, 20);
      WebElement input_userName;
      input_userName = wait.until(ExpectedConditions.elementToBeClickable(By.tagName("input")));
      input_userName.sendkeys("suryap");
      

    You can use ExpectedCondition.visibilityOfElementLocated() as well. You can increase the time, for example,

    WebDriverWait wait=new WebDriverWait(driver, 90);
    

提交回复
热议问题