Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.88 KB

README.markdown

File metadata and controls

50 lines (35 loc) · 1.88 KB

JSErrorCollector

This project allows to capture JavaScript errors while running tests with WebDriver (currently only in Java). Ideally this feature should be built-in WebDriver but it is not (yet?) the case (see WebDriver issue [API for checking for JavaScript errors on the page] 1 for details). Other information concerning JavaScript error capturing with WebDriver is available in this [blog post] 3.

Features

  • provide access to JavaScript errors while running tests with a FirefoxDriver (in Java)

Usage in Java

FirefoxProfile ffProfile = new FirefoxProfile();
JavaScriptError.addExtension(ffProfile);
final WebDriver driver = new FirefoxDriver(ffProfile);

driver.get("http://somesite");
		
final List<JavaScriptError> jsErrors = JavaScriptError.readErrors(driver);
assertTrue("JS errors occured: " + jsErrors, jsErrors.isEmpty());

Download

Pre-built jar file is available in [dist folder] 2.

For non Java users

The Firefox extension (the [.xpi file] 5) can be used from any language having a WebDriver binding. Here are a few examples:

  • [in Ruby from Cucumber + Capybara] 4.
  • [in Ruby with Watir] 8.

A .NET port is available: [JSErrorCollector.NET by protectedtrust] 7.

License

JSErrorCollector is licensed under the terms of the [Apache License 2] 6.