Automation testing Chrome extensions

This article would be helpful if you develop Chrome extension and you need automation testing to reduce cost of testing. We try to automate functional testing of Chrome extension with Selenium WebDriver. On the other hand it may look impossible to automate as Selenium works only with webUI and to manipulate Chrome extension should be used GUI testing tool similar to ldtp. You can use any GUI automation testing tool to test Chrome extension but if you need also test webUI solution would be complex. Let’s start.

By default Selenium can’t manipulate Chrome extension and we should open it in webUI. To open extension in webUI you can use such url:



This url won’t work on your browser as extension may not be installed, that’s why you have to change ID of necessary extension. ID of the extension you can get from this url:


As you can see on screenshot we have just opened extension’s dashboard and now we can manipulate with Selenium.
To record actions we tried to use Selenium IDE for Chrome but for unknown reasons it didn’t record extension’s dashboard.
If Selenium IDE won’t work you can use Chrome’s developer tools to inspect web elements.

Installing Selenium WebDriver

Now we need:

  • Selenium Server
  • Java Client
  • ChromeDriver

You can download listed software here. After downloading unpack ChromeDriver and lauch Selenium Server with command:

java -jar selenium-server-standalone-2.39.0.jar

JAR files from Java Client you should add as external libs depending on your IDE. More detailed information about configuring IDE to run Selenium WebDriver test you can easily find in internet.

After you need set system property, this can be done with code:

System.setProperty("", "/home/user/projects/jmeter/selenium/chromedriver");

By default Chrome doesn’t load extension. To load extension you can use addExtensions() which will load CRX file and install extension.

Sample code:

package mytestpack;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.*;
import org.openqa.selenium.remote.DesiredCapabilities;

public class mytestclass {

public static void main(String[] args) throws InterruptedException{

System.setProperty("", "/home/user/projects/jmeter/selenium/chromedriver");
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/home/user/projects/selenium/extension_1_12.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);

Note, you need to modify sample code to run test. If will be problems with JavaScript after opening extension’s dashboard you can refresh page and dashboard will work.

Interested in our services? Get a free quote! Contact us!


13 thoughts on “Automation testing Chrome extensions

  1. That is a really good tip particularly to those new to the blogosphere.

    Simple but very precise information… Thanks for sharing this
    one. A must read article!

    1. Jay Gupta

      Since I was stumped by the same issue, let me clarify. You can download the same extension from Chrome app store named “Blazemeter”. After installing the extension, you can go to chome settings > extensions and will be able to see that Blazemeter has the same ID

  2. Rakesh

    Hi Bob,
    Can we run extensions in webUI on firefox also? if yes then what is the method. please elaborate
    it will be a great help.. thanks in advance..


      1. Rakesh

        Hi Bob,
        I asked “Can we run extensions in webUI on firefox also? if yes then what is the method. please elaborate”…

  3. Morgan


    I’m a bit confused about the “chrome-extension://mbopgmdnpcbohhpnfglgohlbhfongabi/popup.html” part. I found the ID of the extension I want to test using developer mode, but replacing the ID I found with the ID in the example, or going to “chrome-extension://mbopgmdnpcbohhpnfglgohlbhfongabi” (with my ID) is invalid.

    Where can I find the URL to open my extension in the webUI?

    Thank you.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s