Skip to content

Collects JS errors and make them available from WebDriver (from .NET)

Notifications You must be signed in to change notification settings

otbster/JSErrorCollector.NET

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSErrorCollector.NET

(Note: This is .NET port of the [JSErrorCollector project by mguillem] JSErrorCollectorOriginal)

This project allows to capture JavaScript errors while running tests with WebDriver. 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 .NET)

Usage in .NET test code:

FirefoxProfile ffProfile = new FirefoxProfile();
JavaScriptError.AddExtension(ffProfile);
using (IWebDriver driver = new FirefoxDriver(ffProfile))
{
	driver.Navigate().GoToUrl("http://somesite");

	List<JavaScriptError> jsErrors = JavaScriptError.ReadErrors(driver);
	// Assert that the expected JavaScript errors were returned.
}

Download:

Pre-built .xpi and .NET assembly are available in the dist folder.

For other platforms:

If you're using Java, please see the original [JSErrorCollector project] JSErrorCollectorOriginal. Otherwise, the Firefox extension (the .xpi file) can be used from any language having a WebDriver binding. Here is an example about [how it can be used in Ruby from Cucumber + Capybara] 4.

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

About

Collects JS errors and make them available from WebDriver (from .NET)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 75.0%
  • JavaScript 17.8%
  • PowerShell 7.2%