Skip to content

Instantly share code, notes, and snippets.

@ivaravko
Forked from jarib/test.rb
Created August 9, 2011 09:28
Show Gist options
  • Save ivaravko/1133658 to your computer and use it in GitHub Desktop.
Save ivaravko/1133658 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
browser = Selenium::WebDriver.for :firefox
begin
browser.get "data:text/html;content-type=utf-8,#{URI.escape DATA.read}"
browser.find_element(:tag_name => "div").click
browser.switch_to.alert.accept
ensure
browser.quit
end
__END__
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<div onclick="alert('foo')">foo</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment