Error:org.openqa.selenium.ElementNotVisibleException: You may only interact with visible elements using htmlunitdriver?

♀尐吖头ヾ 提交于 2020-01-07 05:26:07

问题


I am getting this error:

org.openqa.selenium.ElementNotVisibleException: You may only interact with visible elements

when I use HtmlUnitDriver. It works for URL, after that when I start with

driver.findElement(By.cssSelector("#from_city_typeahead")).sendKeys("bangalore"); 

such statements, it gives the above error. Help me to solve this issue.


回答1:


You can do the same action with javascript:

webdriver.executeScript("document.getElementById('elementID').setAttribute('value', 'new value for element')");

Visibility does matter in case of standard visible browsers. But it's doesnt matter for javascript in case of any of browsers.



来源:https://stackoverflow.com/questions/32858986/errororg-openqa-selenium-elementnotvisibleexception-you-may-only-interact-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!