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:

chrome-extension://mbopgmdnpcbohhpnfglgohlbhfongabi/popup.html

screenshot_289

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:

chrome://extensions/

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. Continue reading “Automation testing Chrome extensions”