From 5286214d63695c649943c4b6f6fe352e846d162e Mon Sep 17 00:00:00 2001 From: Vincent Wong Date: Sun, 10 Apr 2016 15:19:21 +1000 Subject: [PATCH] Update README.md to document URL whitelisting **** Context v1.9.0 introduced support for URL whitelisting. However, documentation for whitelisting is still absent from the README **** What's this do? * Update README.md to document URL whitelisting * Change some of the wording of the Blacklisting paragraph --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7122e125..b366f54c 100644 --- a/README.md +++ b/README.md @@ -273,17 +273,27 @@ end * `:port` (Fixnum) - The port which should be used to communicate with the PhantomJS process. Defaults to a random open port. -### URL Blacklisting ### +### URL Blacklisting & Whitelisting ### -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. +Poltergeist supports URL blacklisting, which allows you +to prevent scripts from running on designated domains: ```ruby page.driver.browser.url_blacklist = ['http://www.example.com'] ``` +and also URL whitelisting, which allows scripts to only run +on designated domains: + +```ruby +page.driver.browser.url_whitelist = ['http://www.example.com'] +``` + +If you are experiencing slower run times, consider creating a +URL whitelist of domains that are essential or a blacklist of +domains that are not essential, such as ad networks or analytics, +to your testing environment. + Make sure you set it before each running test, because this setting's cleaned up when capybara does reset.