I've made some work that could become the base to answer the issue 148
"API for checking for JavaScript errors on the page"
(http://code.google.com/p/selenium/issues/detail?id=148#c7).
Daniel Wagner-Hall asked me to send an email here with the proposed API,
the capabilities it adds and the browser requirements. Before to start
such a discussion, I'd like to hear what would be the interest from the
project members for such features (beyond JavaScript errors, all
errors/warning displayed in Firefox or Chrome developer tools could be
interesting). My current feeling is that it is not particularly high but
I would be happy to be wrong ;-)
Cheers,
Marc.
--
HtmlUnit support & consulting from the source
Blog: http://mguillem.wordpress.com
I’ve had a pure-JavaScript version of this for Selenium 1.0 for some time. It mimics the existing getAlert/isAlertPresent interface, adds an ignoreJavaScriptErrors to enable or disable it, and resembles Jason’s proposal except for the JSON response, returning instead one error per getJavaScriptError call the way getAlert does. It injects the necessary hook for window.onerror exactly the same way as the alert support does. That probably means that it has the same can’t-intercept-during-onload-handler problem that the alert support does, but I’ve never tried to confirm that. The code isn’t large (~150 lines of JS in user-extensions.js form, probably less when merged into the main codebase), and it’s hardly novel, but it does the job.
The first time I turned it on in a moderately large established test suite, it found a handful of bugs. It also sped up the failure of the tests in question, because the error was detected nearly immediately, rather than waiting for an expected change to the page and timing out, and provided significantly better diagnostics for the developers to fix the bugs.
I know the Project is usually not interested in enhancements to the RC API and the 1.0 releases, but if desired, I could look into getting permission to hand it over. I expect it wouldn’t be of any value to the WebDriver API.
Ross
--
> On Oct 17, 2011, at 12:46 AM, Rostislav Matl wrote:
>
>> Sounds useful. I'd invite such functionality, especially if it will be
>> possible to turn this behavior off.
>>
>> Still, if I had to choose, I'd prefer accessing the console log
>> messages.
>
> Don't get me wrong, I'd also like to see this. But if I put my Simon
> Stewart hat on, then isn't this out of scope for Selenium? Similarly,
> doing things a user can't do (clicking on an invisible element),
> detecting page performance, or having a more nuanced understanding of
> page load events has also been declared out of scope.
Just a small heads-up: We'll (Opera) be adding support for inspecting the
console to OperaDriver soon.
I'm fine with that being a driver-specific extension, though.
--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To post to this group, send email to selenium-developers@googlegroups.com.
To unsubscribe from this group, send email to selenium-developers+unsub...@googlegroups.com.
To post to this group, send email to selenium-...@googlegroups.com.
To unsubscribe from this group, send email to selenium-develo...@googlegroups.com.
Ross