README.md in poltergeist-1.9.0 vs README.md in poltergeist-1.10.0

- old
+ new

@@ -7,11 +7,11 @@ provided by [PhantomJS](http://phantomjs.org/). **If you're viewing this at https://github.com/teampoltergeist/poltergeist, you're reading the documentation for the master branch. [View documentation for the latest release -(1.8.1).](https://github.com/teampoltergeist/poltergeist/tree/v1.8.1)** +(1.9.0).](https://github.com/teampoltergeist/poltergeist/tree/v1.9.0)** ## Getting help ## Questions should be posted [on Stack Overflow, using the 'poltergeist' tag](http://stackoverflow.com/questions/tagged/poltergeist). @@ -108,10 +108,11 @@ * `page.save_screenshot` * `page.driver.render_base64(format, options)` * `page.driver.scroll_to(left, top)` * `page.driver.basic_authorize(user, password)` * `element.native.send_keys(*keys)` +* `page.driver.set_proxy(ip, port, type, user, password)` * window API * cookie handling * drag-and-drop There are some additional features: @@ -209,15 +210,15 @@ The following methods are used to inspect and manipulate cookies: * `page.driver.cookies` - a hash of cookies accessible to the current page. The keys are cookie names. The values are `Cookie` objects, with the following methods: `name`, `value`, `domain`, `path`, `secure?`, - `httponly?`, `expires`. + `httponly?`, `samesite`, `expires`. * `page.driver.set_cookie(name, value, options = {})` - set a cookie. The options hash can take the following keys: `:domain`, `:path`, - `:secure`, `:httponly`, `:expires`. `:expires` should be a `Time` - object. + `:secure`, `:httponly`, `:samesite`, `:expires`. `:expires` should be a + `Time` object. * `page.driver.remove_cookie(name)` - remove a cookie * `page.driver.clear_cookies` - clear all cookies ### Sending keys ### @@ -260,34 +261,43 @@ * `:phantomjs_logger` (`IO` object) - Where the `STDOUT` from PhantomJS is written to. This is where your `console.log` statements will show up. Default: `STDOUT` * `:timeout` (Numeric) - The number of seconds we'll wait for a response when communicating with PhantomJS. Default is 30. * `:inspector` (Boolean, String) - See 'Remote Debugging', above. -* `:js_errors` (Boolean) - When false, Javascript errors do not get re-raised in Ruby. +* `:js_errors` (Boolean) - When false, JavaScript errors do not get re-raised in Ruby. * `:window_size` (Array) - The dimensions of the browser window in which to test, expressed as a 2-element array, e.g. [1024, 768]. Default: [1024, 768] * `:phantomjs_options` (Array) - Additional [command line options](http://phantomjs.org/api/command-line.html) to be passed to PhantomJS, e.g. `['--load-images=no', '--ignore-ssl-errors=yes']` * `:extensions` (Array) - An array of JS files to be preloaded into the phantomjs browser. Useful for faking unsupported APIs. * `:port` (Fixnum) - The port which should be used to communicate with the PhantomJS process. Defaults to a random open port. +* `:url_blacklist` (Array) - Default session url blacklist - expressed as an array of strings to match against requested URLs. +* `:url_whitelist` (Array) - Default session url whitelist - expressed as an array of strings to match against requested URLs. -### URL Blacklisting ### +### URL Blacklisting & Whitelisting ### +Poltergeist supports URL blacklisting, which allows you +to prevent scripts from running on designated domains: -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. - ```ruby 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. +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. + + ## Troubleshooting ## Unfortunately, the nature of full-stack testing is that things can and do go wrong from time to time. This section aims to highlight a number of common problems and provide ideas about how you can work around them. @@ -356,11 +366,11 @@ straightforward to verify this by adding `sleep` statements into your test to allow sufficient time for the page to settle. If you have these types of problems, read through the [Capybara documentation on asynchronous -Javascript](https://github.com/jnicklas/capybara#asynchronous-javascript-ajax-and-friends) +JavaScript](https://github.com/jnicklas/capybara#asynchronous-javascript-ajax-and-friends) which explains the tools that Capybara provides for dealing with this. ### Memory leak ### If you run a few capybara sessions manually please make sure you've called @@ -390,10 +400,10 @@ * Specific steps to reproduce where possible (failing tests are even better) * The output obtained from running Poltergeist with `:debug` turned on * Screenshots -* Stack traces if there are any Ruby on Javascript exceptions generated +* Stack traces if there are any Ruby on JavaScript exceptions generated * The Poltergeist and PhantomJS version numbers used * The operating system name and version used ## Changes ##