Skip to content

Instantly share code, notes, and snippets.

@jarib
Created September 15, 2012 00:19
Show Gist options
  • Save jarib/3725732 to your computer and use it in GitHub Desktop.
Save jarib/3725732 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile.log_file = "/tmp/firefox.log"
browser = Selenium::WebDriver.for :firefox, :profile => profile
browser.get "data:text/html;content-type=utf-8,#{URI.escape DATA.read}"
browser.find_element(tag_name: 'a').click
browser.quit
Dir['/tmp/firefox{,-*}.log'].each do |path|
puts path
puts File.read(path)
end
__END__
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
<a href="#" onclick="throw 'oops'">Click me</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment