org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook

前端 未结 4 1982
囚心锁ツ
囚心锁ツ 2020-11-22 02:35

The error is :

Exception in thread \"main\" org.openqa.selenium.ElementNotInteractableException: Element 
is not rea
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 02:49

    In one of the use cases I had the same issue:

    Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element 

    using id for identifying an element before sending keys. Something like:

    driver.findElement(By.id("search")).sendKeys("...");
    

    After testing I changed to CSS Selector and it solved the issue:

    driver.findElement(By.cssSelector("#search > input:nth-child(2)")).sendKeys("...");
    

    So, I highly recommend to use different methods to interact with the elements, because something else can save your time solving problems.

提交回复
热议问题