Selenium IDE

Selenium IDE

  • Docs
  • API
  • Plugins
  • Blog
  • Help

›Introduction

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

Plugin Health Checks

Plugins can only register with Selenium IDE when the extension window is open.

Registering before that will yield an error saying Selenium IDE is not active.

To deal with that you can send a message to the System API's health check.

Health Request

{
  uri: "health",
  verb: "get"
}

Health Response

  • error - Either Selenium IDE is inactive, or not installed.
  • true - Your plugin is already registered and able to accept requests.
  • false - Your plugin is not registered and should send a [[registration | Getting Started with Plugins#registering-the-plugin]] request.

Polling the Health Checks

You can use this health checking mechanism to introduce polling and register when Selenium IDE goes active.

You should keep polling Selenium IDE even after, since the user can close the IDE's window.

let interval;

export function sendMessage(payload) {
  return browser.runtime.sendMessage(SIDE_ID, payload);
}

export function startPolling(payload, cb) {
  interval = setInterval(() => {
    sendMessage({
      uri: "/health",
      verb: "get"
    }).catch(res => ({error: res.message})).then(res => {
      if (!res) {
        sendMessage({
          uri: "/register",
          verb: "post",
          payload
        }).then(() => {
          console.log("registered");
          cb();
        });
      } else if (res.error) {
        cb(new Error(res.error));
      }
    });
  }, 1000);
}

export function stopPolling() {
  clearInterval(interval);
}

This way you can retry connecting to the IDE every second, and if the IDE window is closed, within a second you'll get a callback notifying you of that.

Last updated on 2/19/2019
← Selenium IDE Extension IDRequests →
  • Health Request
  • Health Response
  • Polling the Health Checks
Selenium IDE
Docs
Getting StartedAPI ReferenceBuild a Plugin
Community
Slackirc (#selenium)Google group
More
BlogGitHubStarLegacy IDE
Copyright © 2019 Software Freedom Conservancy (SFC)