Approach to Automation of firefox and Chrome extensions using Selenium

Browser extensions does not use browser space for it’s GUI display and user interaction, this making it impossible to automate it through Selenium.

But, fortunately, you can run the extension in browser space with little trick and with that you can automate it using Selenium

Below steps will help you do exactly same for a Chrome extension called packman ( https://chrome.google.com/webstore/detail/pacman/palgcoflnoaklkflllnmheiollkgkipm)

Steps:

Way 1:

1.  go to Extension location on the disk . In case of Mac , it’s ~//Library/Application Support/Google/Chrome/Default/Extensions

2. You can find all the extension (installed) here, you can go to folder “palgcoflnoaklkflllnmheiollkgkipm”

palgcoflnoaklkflllnmheiollkgkipm can be found in the Chrome webstore URL

3. find all the html file under this folder. In most cases, you’ll find only one. ( You can use command like find . -name *html ). In case of Packman, you will find  –> ./1.26_0/popup.html

4. Access Pacman in browser interface

Type below in your Chrome Location bar:  chrome-extension://palgcoflnoaklkflllnmheiollkgkipm/popup.html

You can access packman in your browser i.e. You can automate them using Selenium.

On Firefox, the URL will be

chrome://pacman/content/pacman.xul

You can refer to below file to find the URL :

~/Library/Application\ Support/Firefox/Profiles/<profileName>/extensions/pacman\@oppermann.ch.xpi

However, there are some trick involved when it comes to automating it with Selenium. I’ll cover steps for doing it with Java/Python on Firefox and Chrome in next blog.

Advertisements