11

Is there a way we can install chrome extensions (.crx) with phantomjs?

My task here is to integrate adblockplus with phantomjs so that I can filter all the ad-urls and report using phantomjs.

Or any other way to integrate the adblockplus extension with phantomjs?

Devaroop
  • 7,900
  • 2
  • 37
  • 34
  • Yes. So what have you tried that didnt work? – Zig Mandel May 12 '14 at 12:56
  • @ZigMandel I hav the code for adblockplus. I am not sure what is its entry point and where does it fit into PhantomJs so that it starts working. Ideally, it should be active before `page.open`. I can tweek the extension and append it in `onResourceRequested` callback. Wanted to know if there is any other way – Devaroop May 13 '14 at 06:12
  • Do you have an update or even an answer? – Artjom B. May 21 '14 at 21:18
  • @ArtjomB.- There doesn't seem to be any way to integrate the whole extension. I instead had to implement the part of adblockplus logic into phantomjs which I required. – Devaroop May 22 '14 at 06:31
  • Want exactly the same for a 'automated content extraction algorithm'. Did you found any solution? – Frank Roth Sep 17 '14 at 09:01
  • @FrankRoth: Sadly, no. I extracted parts of what I wanted and re-wrote them in phantom. – Devaroop Sep 17 '14 at 10:23
  • @Devaroop, do you still have that code? Can you share it? How complicated is it to implement? Thanks – Bogdan Păun Feb 05 '16 at 12:51
  • @BogdanPăun None yet, I have moved away from it now. – Devaroop Feb 19 '16 at 07:41

1 Answers1

3

PhantomJS is based on a three-year old WebKit fork (QtWebKit), not Chromium. Therefore you cannot load Chrome extensions in PhantomJS.

If you want to use Chrome extensions in an automated way, I suggest to use the ChromeDriver from the Selenium WebDriver project.

Rob W
  • 341,306
  • 83
  • 791
  • 678