Python Using Adblock with Selenium and Firefox Webdriver

Actually, Adblock Plus will add EasyList by default - but not if you set extensions.adblockplus.currentVersion preference to disable update/first-run actions. I guess that your goal was preventing the first-run page from showing up but it also prevented data storage initialization. Note that you have more issues here: even if Adblock Plus adds EasyList, it will still take an unknown time to download.

The better course of action should be initializing your profile with an existing adblockplus/patterns.ini file. You can get this file from your regular Firefox profile, with EasyList and other filter settings, and copy it to /Users/username/Downloads/profilemodel/adblockplus/patterns.ini. Then the following should work:

ffprofile = webdriver.FirefoxProfile("/Users/username/Downloads/profilemodel");

There's a better way to do this:

1) extract adblock.xpi with 7-zip or equivalent

2) open /modules/AppIntegration.jsm with a regular text editor

3) find the function declaration for "notifyUser()", and replace this with a simple return. for example:

/**
* function notifyUser()
* {
*   let wrapper = (wrappers.length ? wrappers[0] : null);
*   if (wrapper && wrapper.addTab)
*   {
*       wrapper.addTab("chrome://adblockplus/content/ui/firstRun.xul");
*   }
*   else
*   {
*       Utils.windowWatcher.openWindow(wrapper ? wrapper.window : null,
*                                                                    "chrome://adblockplus/content/ui/firstRun.xul",
*                                                                    "_blank", "chrome,centerscreen,resizable,dialog=no", null);
*   }
* }
*/

function notifyUser()
{
    return;
}

Now you just need to package the files back into a zip, and change the extension from .zip to .xpi -- Voila!

This will stop adblock from loading the welcome page, but it will still configure the necessary subscription settings. Make sure NOT to call

ffprofile.set_preference("extensions.adblockplus.currentVersion", "x.x.x")

Otherwise, it will not know to "boot itself"

Please note that this is for adblock_plus-2.0.3 since I'm using firefox-17. The code may be slightly different, and in a different location for newer versions. See: https://issues.adblockplus.org/ticket/206#comment:5