Skip to content

Instantly share code, notes, and snippets.

@jarib
Created July 14, 2011 19:17
Show Gist options
  • Save jarib/1083202 to your computer and use it in GitHub Desktop.
Save jarib/1083202 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
d = Selenium::WebDriver.for :firefox
begin
d.get "data:text/html,#{URI.escape DATA.read}"
d.find_elements(:tag_name => "option").last.click
sleep
ensure
d.quit
end
__END__
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script>
$(document).ready(function() {
$("#s").change(function() { alert(this.innerHTML); });
});
</script>
</head>
<body>
<select id="s"><option>foo</option>
<option>bar</option>
</select>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment