Add another example of `Capybara.string`
I read the existing document, but I was still having trouble with a single element (I was missing the `first('a')` part), so I thought another example would help someone else.
This commit is contained in:
parent
dfd985fdf2
commit
e317c19bd6
|
@ -140,7 +140,16 @@ module Capybara
|
||||||
# in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers},
|
# in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers},
|
||||||
# {Capybara::Node::Finders} and {Capybara::Node::DocumentMatchers}. This allows you to query
|
# {Capybara::Node::Finders} and {Capybara::Node::DocumentMatchers}. This allows you to query
|
||||||
# any string containing HTML in the exact same way you would query the current document in a Capybara
|
# any string containing HTML in the exact same way you would query the current document in a Capybara
|
||||||
# session. For example:
|
# session.
|
||||||
|
#
|
||||||
|
# Example: A single element
|
||||||
|
#
|
||||||
|
# node = Capybara.string('<a href="foo">bar</a>')
|
||||||
|
# anchor = node.first('a')
|
||||||
|
# anchor[:href] #=> 'foo'
|
||||||
|
# anchor.text #=> 'bar'
|
||||||
|
#
|
||||||
|
# Example: Multiple elements
|
||||||
#
|
#
|
||||||
# node = Capybara.string <<-HTML
|
# node = Capybara.string <<-HTML
|
||||||
# <ul>
|
# <ul>
|
||||||
|
|
Loading…
Reference in New Issue