Skip to content

Instantly share code, notes, and snippets.

@ivaravko
Forked from jarib/gist:1083202
Created August 9, 2011 09:27
Show Gist options
  • Save ivaravko/1133656 to your computer and use it in GitHub Desktop.
Save ivaravko/1133656 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