
Untitled
By: a guest on
May 17th, 2012 | syntax:
None | size: 0.58 KB | hits: 13 | expires: Never
require 'watir-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile.log_file = "/tmp/firefox.log"
d = Watir::Browser.new :firefox, :profile => profile
d.goto "data:text/html;content-type=utf-8,#{URI.encode DATA.read}"
d.quit
Dir['/tmp/firefox*.log'].each do |file|
p :file => file, :has_client_error => File.read(file).include?('oops')
end
# output:
#
# {:file=>"/tmp/firefox-1.log", :has_client_error=>false}
# {:file=>"/tmp/firefox.log", :has_client_error=>true}
#
__END__
<html>
<body>
<script>
throw new Error('oops');
</script>
</body>
</html>