Capybara/Poltergeist/PhantomJS blacklisting

Poltergeist supports URL blacklisting which allows you to prevent scripts from running on designated domains. If you are experiencing slower run times, consider creating a URL blacklist of domains that are not essential to your testing environment, such as ad networks or analytics.

page.driver.browser.url_blacklist = ['http://www.example.com']

Make sure you set it before each running test, because this setting’s cleaned up when capybara does reset.

for example like so:

config.before(:each, js: true) do
    page.driver.browser.url_blacklist = ["http://use.typekit.net"]
end

via teampoltergeist/poltergeist: A PhantomJS driver for Capybara.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s