Guest User

Untitled

a guest
Jan 22nd, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. require 'watir-webdriver'
  2.  
  3. profile = Selenium::WebDriver::Firefox::Profile.new
  4. profile.log_file = "/tmp/firefox.log"
  5.  
  6. d = Watir::Browser.new :firefox, :profile => profile
  7. d.goto "data:text/html;content-type=utf-8,#{URI.encode DATA.read}"
  8. d.quit
  9.  
  10. Dir['/tmp/firefox*.log'].each do |file|
  11. p :file => file, :has_client_error => File.read(file).include?('oops')
  12. end
  13.  
  14. # output:
  15. #
  16. # {:file=>"/tmp/firefox-1.log", :has_client_error=>false}
  17. # {:file=>"/tmp/firefox.log", :has_client_error=>true}
  18. #
  19.  
  20. __END__
  21. <html>
  22. <body>
  23. <script>
  24. throw new Error('oops');
  25. </script>
  26. </body>
  27. </html>
Add Comment
Please, Sign In to add comment