user2887254
user2887254

Reputation: 33

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?

Upvotes: 2

Views: 6637

Answers (1)

Alec
Alec

Reputation: 509

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").

Upvotes: 5

Related Questions