mguillem/JSErrorCollector — Issue #1: When moving to a different page intermittent "window.JSErrorCollector_errors is undefined" exception
Author: jopombar
Created: 2011-11-04 20:30:49+00:00
State: open

To reproduce:
- Add the extension to the FF profile and get a driver with that profile (as shown on the sample code)
- Perform an event that will move to a different page (click a button in my case)
- Call JavaScriptError.readErrors(driver);

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]