Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can watir-webdriver capture console errors?

I am wondering if watir-webdriver as the ability to log the output of any console errors? This would be equivalent to manually opening the console in a browser and watching for JS errors as a page loads. Can I capture this through watir-webdriver and log/error on?

like image 748
negativebase Avatar asked Sep 07 '11 20:09

negativebase


1 Answers

If it will be helpful to someone - this solution should work:

def check_console_log
    console_log = @browser.driver.manage.logs.get(:browser)
    if console_log != nil
      raise(console_log)
    end
end
like image 137
Kirikami Avatar answered Sep 23 '22 18:09

Kirikami