Skip to content

Commit

Permalink
Update README adding explaination for using app_host to call remote w…
Browse files Browse the repository at this point in the history
…eb servers
  • Loading branch information
Joseph Wilk and Matt Wynne committed Feb 3, 2010
1 parent 95a63f8 commit 4305776
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Culerity doesn't seem to be working under Ruby 1.9 at the moment.

== The DSL

Capybara's DSL is inspired by Webrat. While backwards compatibility is retained
Capybara's DSL is inspired by Webrat. While backwards compatibility is retained
in a lot of cases, there are certain important differences.

Unlike in Webrat, all searches in Capybara are *case sensitive*. This is because
Expand Down Expand Up @@ -193,7 +193,7 @@ certain elements, and working with and manipulating those elements.
page.has_xpath?('//table/tr')
page.has_css?('table tr.foo')
page.has_content?('foo')

You can use with RSpecs magic matchers:

page.should have_xpath('//table/tr')
Expand All @@ -210,7 +210,7 @@ You can also find specific elements, in order to manipulate them:
find_field('First Name').value
find_link('Hello').visible?
find_button('Send').click

find('//table/tr').click
wait_for("//*[@id='overlay'").find("//h1").click
all('a').each { |a| a[:href] }
Expand Down Expand Up @@ -280,6 +280,19 @@ examples. Just load the dsl and include it anywhere:
end
click_link 'Sign in'

== Calling remote servers

Normally Capybara expects to be testing an in-process Rack application, but you can also use it to talk to a web server running anywhere on the internets, by setting app_host:

require 'capybara'
require 'capybara/dsl'

include Capybara
Capybara.current_driver = :selenium
Capybara.app_host = 'http://www.google.com'

visit('/')

== Using the sessions manually

For ultimate control, you can instantiate and use a session manually.
Expand All @@ -300,7 +313,7 @@ if you want to use CSS with your 'within' declarations for example, you'll need
to do:

within(:css, 'ul li') { ... }
find(:css, 'ul li').text
find(:css, 'ul li').text
locate(:css, 'input#name').value

Alternatively you can set the default selector to CSS, which may help if you are
Expand Down

0 comments on commit 4305776

Please sign in to comment.