JSErrorCollector for Chrome
Python JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
extension
test
.gitignore
LICENSE
README.md
extension.crx
sample.py

README.md

ChromeJSErrorCollector

Introduction

JSErrorCollector for Chrome provide access to JavaScript errors while running tests with a ChromeDriver.

Usage

Simple Python code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_extension('extension.crx')
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://stuff-dharrya.rhcloud.com/get_js_error')
print(driver.execute_script('return window.JSErrorCollector_errors ? window.JSErrorCollector_errors.pump() : []')) 
driver.quit()

Will output:

[{
	'sourceName': 'http://stuff-dharrya.rhcloud.com/get_js_error',
	'pageUrl': 'http://stuff-dharrya.rhcloud.com/get_js_error',
	'errorMessage': 'ReferenceError: someVariable is not defined',
	'lineNumber': 9
}]

Thanks

I've been inspired to this by Oleg Strokatyy. He is a nice funny guy and great professional:-)