Selenium IDE

Selenium IDE

  • Docs
  • API
  • Plugins
  • Blog
  • Help

›Concepts

Introduction

  • Getting Started
  • Selenium IDE Extension ID
  • Health Checks

Concepts

  • Requests
  • Error Handling
  • Emitting Code
  • Exporting Code

Extending the IDE

  • Adding Commands
  • IDE Events
  • Emitting Setup & Teardown

API Reference

  • Introduction
  • System
  • Playback
  • Record
  • Popup
  • Export

Error Handling

If you encounter a failure when executing a command and need to fail the test case because of it, you'll have to respond with an error to the IDE.

Since JSON doesn't support Error serializations, a standard was made by the IDE.

Error

An error object is a normal JavaScript object, that when sent to the IDE, will be parsed as an error.

{
  status: "fatal",
  error: "This command can't be run individually, please run the test case."
}
  • status - optional, can be undefined or fatal, a fatal error will fail the test, a non-fatal error will continue execution, useful for the verify commands.
  • error - required, message to be printed to the user.

Sending the Error

When encountering an error during execution, you can reply with the error object using sendResponse.

browser.runtime.onMessageExternal.addListener((message, sender, sendResponse) => {
    if (message.action === "execute" && message.command && message.command.command === "myFailingCommand") {
      executingSomeFunctionalityThatWillEventuallyFail(message.command).catch((error) => {
        return sendResponse({ error: error.message, status: "fatal" });
      });
      return true;
    }
});
Last updated on 2/21/2019
← RequestsEmitting Code →
  • Error
  • Sending the Error
Selenium IDE
Docs
Getting StartedAPI ReferenceBuild a Plugin
Community
Slackirc (#selenium)Google group
More
BlogGitHubStarLegacy IDE
Copyright © 2019 Software Freedom Conservancy (SFC)