Features
< Back to Blog Overview

Automated testing on multiple browsers

2016-06-15
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

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
caps.name = "My First Extension Test"
caps["load-extension"] = "https://staging/myextension[.xpi/.crx/.safariextz]"

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120

driver = Selenium::WebDriver.for(
  :remote,
  :url => "http://API_KEY:API_SECRET@hub.testingbot.com/wd/hub",
  :desired_capabilities => caps,
  :http_client => client)
driver.navigate.to "http://www.google.com"
element = driver.find_element(:name, 'added-by-extension')
p element.inspect
driver.quit

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.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Safari Technology Preview: Automated Testing with WebDriver

Safari Technology Preview provides a way to have an early look at the upcoming web technologies in OS X and iOS.

Read more
TestingBot translated in German, Spanish and French

TestingBot is located and operated from the heart of Europe: Belgium. In Europe, we have a great mix of different languages that people speak an...

Read more
blank

To keep our Selenium grid with over 1500+ real browsers healthy, we use various tools and techniques to monitor and troubleshoot potential problems...

Read more
blank

Starting with Firefox 46, it will no longer be possible to install unsigned extensions with Firefox. Since Selenium currently uses a Firefox ext...

Read more
blank

In this article we'll focus on setting up your own Selenium grid from scratch. A Selenium grid is a collection of browser nodes that are available...

Read more
Working on a real mobile device farm

Update: this feature is now available, please see our real mobile devices. We are working hard on providing a real mobile-device test lab to our...

Read more