Skip to content

Commit

Permalink
Remove/update outdated README sections
Browse files Browse the repository at this point in the history
  • Loading branch information
joliss committed Jan 4, 2012
1 parent 8c6ff16 commit 7a856b7
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions README.md
Expand Up @@ -376,10 +376,12 @@ page.has_no_selector?(:content)

page.has_xpath?('//table/tr')
page.has_css?('table tr.foo')
page.has_content?('foo')
page.has_text?('foo')
page.has_text?('foo') # synonymously: page.has_content?('foo')
```

**Note:** The negative forms like `has_no_selector?` are different from `not
has_selector?`. Read the section on asynchronous JavaScript for an explanation.

You can use these with RSpec's magic matchers:

```ruby
Expand All @@ -390,18 +392,8 @@ page.should have_no_selector(:content)
page.should have_xpath('//table/tr')
page.should have_css('table tr.foo')
page.should have_text('foo')
page.should have_no_text('foo')
```

**Note** that there are 2 matchers for checking content/text. `page.has_text?('foo')`
will check only for text that is displayable, whereas `page.has_content?('foo')` will
check for the content within any nodes (including the head section and within script tags).
Most of the time you'll want the behaviour of `page.has_text?('foo')`, so go with that
unless you have a specific reason to use `page.has_content?('foo')` instead.

**Note**: `page.should have_no_xpath` is preferred over `page.should_not have_xpath`.
Read the section on asynchronous JavaScript for an explanation.

If all else fails, you can also use the
<tt>[page.html](http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Session#html-instance_method)</tt>
method to test against the raw HTML:
Expand Down

0 comments on commit 7a856b7

Please sign in to comment.