Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3751104
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:01:37+00:00 2026-05-19T09:01:37+00:00

I’m working with Selenium right now, and I’d like to know if it’s possible

  • 0

I’m working with Selenium right now, and I’d like to know if it’s possible to make Selenium find out if there were script errors.

I’m conscious that acting upon script errors would require flow control, and that Selenium IDE doesn’t have that. I’m also conscious that if the errors were serious, then certainly the test cases would fail, and there we have it. Still, I’d like Selenium to be able to at least store them somewhere, somehow.

We run our tests in Firefox and IE, so we can use window.onerror to record errors. However, I’m not sure about how to integrate it to Selenium. As far as I know, the recorder attaches its handler to window.document, and we would need to attach to window itself. I’ve tried to decorate Recoreder.prototype.attach from the user extension file to add a handler myself, but it’s rather clumsy and causes odd behaviors in the IDE (like nothing records anymore, so I probably did it wrong).

Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:01:38+00:00Added an answer on May 19, 2026 at 9:01 am

    I’ve dug deep enough in Selenium to get a good answer.

    Decorating Recorder.prototype.attach and Recorder.prototype.detach works well; you just have to attach yourself to the window.onerror event to get a good idea of what kind of bad things happen on your page. The problems come when it’s time to act upon the errors. There are two choices:

    • Create a custom command that checks if there were errors since the last time it was called;
    • Edit Selenium’s source code to make it check if there were errors with the last command before each new command.

    It is not possible to implement the latter with extensions because the file you need to change the behavior of is loaded after the extension files.

    Here is how you can decorate the appropriate function from an user extension:

    function decorate(decoratee, decorator) {
        var decorated = function() {
            decorator.apply(this, arguments);
            if (decoratee && decoratee.apply)
                decoratee.apply(this, arguments);
        }
        decorated.base = decoratee;
        decorated.decorator = decorator;
        return decorated;
    }
    
    Recorder.prototype.attach = decorate(Recorder.prototype.attach, function() {
        var win = this.getWrappedWindow();
        win.onerror = decorate(win.onerror, function(message, file, line) {
            // do something with the error
        });
    });
    
    Recorder.prototype.detach = decorate(Recorder.prototype.detach, function() {
        var win = this.getWrappedWindow();
        win.onerror = win.onerror.base;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.