Skip to content

Instantly share code, notes, and snippets.

@abotalov
Last active December 17, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abotalov/5571262 to your computer and use it in GitHub Desktop.
Save abotalov/5571262 to your computer and use it in GitHub Desktop.
Possible bug in Capybara
require 'capybara'
require 'capybara-webkit'
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
Capybara.ignore_hidden_elements = true
session = Capybara::Session.new(:selenium, app)
session.visit("/")
session.find(:select, 'select_box_id', visible: false)
session.select('value', from: 'select_box_id', visible: false) # this triggers Capybara::ElementNotFound in 2.0.2 but doesn't trgigger it in 2.1 (it triggers Selenium::WebDriver::Error::ElementNotVisibleError if driver is :selenium in 2.1 as element is invisible)
__END__
<!doctype html>
<html>
<body>
<select id="select_box_id" style="display:none">
<option>default</option>
<option>value</option>
</select>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment