mguillem / jserrorcollector Goto Github PK
View Code? Open in Web Editor NEWCollects JS errors and make them available from WebDriver
Collects JS errors and make them available from WebDriver
What is the oldest version of FireFox that this tool (JSErrorCollector) will work with?
Michael
Hi,
It could be great if you can make the JAR of 'JSErrorCollector' is available to the Maven central repository(http://search.maven.org/).
Regards,
Mahadi
Excellent!
however does it support capturing warnings? I did try but it didn’t find any. Kindly please update.
Hello,
I cannot find any information about the licencing for this project? I was wondering what the licencing situation is?
Thanks,
Beccy
Thank you for the great API. Not long ago I've started use it and found several js-errors with it. When I wrote bug-reports about found errors I realized that it's not always obvious to find the page on which the js-error occured if we read errors after visit more than one page. Therefore it would be great if JavaScriptError class collects not only errorMessage, sourceName and lineNumber but also URL of the page with an error too.
I'm using WebDriver to start Firefox.
Then I use SikuliX to send keystrokes and mouse clicks.
After, I try to collect all errors by using:
JavaScriptError.readErrors(driver)
The result is always:
NoSuchWindowException Browsing context has been discarded
even though I haven't called driver.close()
.
How can I capture errors?
More info:
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 66.0.5,
javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.24.0,
moz:headless: false, moz:processID: 2248, moz:profile: /tmp/rust_mozprofile.4rGV9F...,
moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false,
moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX,
platformName: LINUX, platformVersion: 3.10.0-862.14.4.el7.x86_64, rotatable: false,
setWindowRect: true, strictFileInteractability: false,
timeouts: {implicit: 0, pageLoad: 300000, script: 30000},
unhandledPromptBehavior: dismiss and notify}
Versions:
This trace could provide a hint of what is going on:
File /tmp/rust_mozprofile.QWClT5upzfGf/extensions/[email protected] does not contain a valid manifest(resource://gre/modules/addons/XPIInstall.jsm:557:11) JS Stack trace: [email protected]:557:11
[email protected]:186:3
[email protected]:620:10
[email protected]:2340:21
[email protected]:2700:21
[email protected]:2570:34
[email protected]:2148:25
[email protected]:203:12
[email protected]:652:5
[email protected]:805:9
[email protected]:2775:5
[email protected]:66:9
Is there anyway such that I can get all the console error logs (not only javascript) using this , maybe be tweaking this source code?
When I try to set up to use JSErrorCollector with a JavaScriptError.addExtension(profile) call, WebDriver hangs creating the driver with a stack like this:
Thread main
Thread.sleep(long) line: not available [native method]
NewProfileExtensionConnection.start() line: 111
FirefoxDriver.startClient() line: 244
FirefoxDriver(RemoteWebDriver).(CommandExecutor, Capabilities, Capabilities) line: 110
FirefoxDriver.(FirefoxBinary, FirefoxProfile, Capabilities, Capabilities) line: 188
FirefoxDriver.(FirefoxBinary, FirefoxProfile, Capabilities) line: 183
FirefoxDriver.(Capabilities) line: 100
To reproduce:
Notice that you'll start getting "window.JSErrorCollector_errors is undefined" exception intermittently.
I was able to get around this issue by sleeping for 100ms before making the JavaScriptError.readErrors(driver) call. I also tried with 50ms but it I still got the exception sporadically.
Here is the stack trace that I see:
[ERROR][2011-11-04 13:28:53,360][c.s.s.c.xxx]- [assertNoJSErrors] Unexpected exception on assertNoJSErrors()
org.openqa.selenium.WebDriverException: window.JSErrorCollector_errors is undefined (WARNING: The server did not provide any stacktrace information); duration or timeout: 250 milliseconds
Build info: version: '2.8.0', revision: '14056', time: '2011-10-06 12:42:36'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_26'
Driver info: driver.version: ReportingWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.6.0_26]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.6.0_26]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.6.0_26]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.6.0_26]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147) ~[selenium-java-2.8.0.jar:na]
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113) ~[selenium-java-2.8.0.jar:na]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:415) ~[selenium-java-2.8.0.jar:na]
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:327) ~[selenium-java-2.8.0.jar:na]
at net.jsourcerer.webdriver.jserrorcollector.JavaScriptError.readErrors(JavaScriptError.java:95) ~[JSErrorCollector-0.1.jar:na]
Hello ! Thanks for your API!
As I can see in source code you use window.JSErrorCollector_errors.pump()
, but when the code try to execute this command we can see next error in console
Permission denied to access property "pump"
Can you help with it ?
Thanks for the excellent plugin, we have been able to catch a bunch of issues with it by running it in our Selenium "get" calls!
It would be great if you could print the stack trace from the errors as well via the collector. Would implementing this be possible? On javascript, there are ways of retrieving the stack traces: http://stackoverflow.com/questions/3283576/how-to-trace-javascript-events-stack-trace
Currently errors are captured and persisted across pages. This is impacting our implementation as, when we want to check if any errors are present on the current screen, we are also seeing errors from all the previous screens. This makes it impossible to determine whether it is the current page or a previous page that has errors.
I was trying to capture error like https://docs.angularjs.org/error/$compile/multidir, via JSErrorCollector, but it is not able to capture this type of errors.
attached is the screen-shot of error I am trying to capture.
Tool fails to catch this error "TypeError: $(...) is null" on this page http://www.cnn.com/POLITICS/
As reported by FireBug.
I have two suspicions as to why this would be.
I get following error after updating to webdriver 2.45.0 and Firefox 36:
org.openqa.selenium.WebDriverException: Exposing privileged or cross-origin callable is prohibited
Command duration or timeout: 31 milliseconds
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'TPOREBA-W', ip: '10.10.8.47', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_10'
Session ID: c0dc3661-9622-47c9-88af-566e20a25e9a
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=36.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
at net.jsourcerer.webdriver.jserrorcollector.JavaScriptError.readErrors(JavaScriptError.java:135)
It seems new Firefox doesn't like the script from JavaScriptError.readErrors
line 134:
return window.JSErrorCollector_errors ? window.JSErrorCollector_errors.pump() : []
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.