Automated testing of Firefox, Chrome and Safari browser extensions

With Selenium Webdriver, you can run tests on Firefox, Chrome and Safari, all of them equipped with your browser extension.

At TestingBot, we’ve made this very easy for you!
All you need to do is supply a link to the extension in your desired_capabilities options of your test. Specify either the .xpi file (for Firefox), .crx file (for Chrome) or .safariextz file (for Safari).

TestingBot will then download the extension and add it to the browser (Firefox, Chrome or Safari) before the start of the test.

During your test, you can then check if the extension is functioning correctly. For example: does it modify the page correctly, does it do what it’s supposed to do, …

This is a great way to test your extensions before publishing them to the public. With a massive range of browser combinations, you can test your extensions on both old, new and even beta/dev versions of browsers.

Browser Extension Test Example

Below is an example on how to do this with Firefox, Chrome and Safari

#!/usr/bin/env ruby

require 'rubygems'
require 'selenium-webdriver'

caps = Selenium::WebDriver::Remote::Capabilities.firefox
caps.version = "latest"
caps.platform = :WINDOWS = "My First Extension Test"
caps["load-extension"] = "https://staging/myextension[.xpi/.crx/.safariextz]"

client =
client.timeout = 120

driver = Selenium::WebDriver.for(
  :url => "",
  :desired_capabilities => caps,
  :http_client => client) ""
element = driver.find_element(:name, 'added-by-extension')
p element.inspect

This example will start the latest, stable Firefox browser on our cloud, with the extension you specified in “load-extension” already installed.
The extension can either be an extension that’s already available to the general public, or it can be an extension you’re still working on and want to test.

In this example, the test will then go to Google and see if your extension really did modify the page (added a ‘added-by-extension’ element to the DOM).

Combined with our other extra’s like video recording, screen resolution specification and more, this type of testing can be very beneficial to make sure your extension works correctly across both older versions, stable versions and upcoming versions of the browser you’re targeting.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *