Skip to content

Instantly share code, notes, and snippets.

@twalpole
Created October 19, 2018 15:38
Show Gist options
  • Save twalpole/4f5817cca42dba751e1e04baf16dd979 to your computer and use it in GitHub Desktop.
Save twalpole/4f5817cca42dba751e1e04baf16dd979 to your computer and use it in GitHub Desktop.
require "selenium/webdriver"
require "capybara/dsl"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app) # use firefox
# sess = Capybara::Session.new(:selenium_chrome, app) # use chrome
sess.visit("/")
sess.select('postgres')
sleep 20
__END__
<!doctype html>
<html>
<head>
<title>Some title</title>
</head>
<body>
<select id="db_select" oninput="alert('input fired')">
<option value=""> Please select a driver</option>
<option value="mysql">mysql</option>
<option value="postgres">postgres</option
</select>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment