简体   繁体   中英

Selenium Web Driver Ruby- Element not visible exception

The web page snippet looks like this:

<div id="HPSearchInput">
<form>
<ul></ul>
<input type="submit" data-ember-action="3" class="ch-btn searchBtn"        value="Search">
</form>

I am using the following css selector to click on the search button:

wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { (driver.find_element(:css => "#HPSearchInput > form > input.ch-  btn.searchBtn")).click() }

It is giving me the error: ElementNotVisibleError

Where am I going wrong?

Is it an element that doesn't appear right away? If so, try:

wait.until { driver.find_element(:css => "#HPSearchInput > form > input.ch-  btn.searchBtn").displayed? }
driver.find_element(:css => "#HPSearchInput > form > input.ch-  btn.searchBtn").

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM