سؤال

Is there a way to run automatic tests, using a headless browser (i.e. PhantomJS, Selenium) that loads browser extensions/plugins/addons?

More specifically, I'd like to simulate the effects of ad-blockers (like Ghostery, ad-block+) on my code, to see if they break it.

I saw PhantomJS does not support the Flash plugin since 2012, but was wondering if there's a way to still simulate said conditions.

هل كانت مفيدة؟

المحلول

So, apparently, shoehorning plugins into server side browsers is near impossible, or not recommended.

I've overcome my problem by using client-side unit tests (using QUnit), but I believe the original issue can be solved by adding firewall/iptable rules that block specific urls that serve ads, on the machine used for testing.

The list of blocked urls can be taken from the ad-blocker plugins themselves, and updated regularly.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top