Sha256: fbcb2e3013731db9fd01e2cd28441854251f02f6d4bafd158136a94f5255d92d

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

session = Capybara::Session.new('http://localhost:3000')

session.visit '/'

session.driver.trigger :click, '//div[@id=foo]//a'
session.driver.trigger :mouseover, '#foo a.bar' # will be ignored by drivers who do not support it

nodelist = session.find 'li#foo a'
nodelist.empty?
nodelist.first.tag_name   # => 'a'
nodelist.first.text       # => 'a cute link'
nodelist.first.html       # => 'a <em>cute</em> link'
nodelist.first.attributes # => { :href => '/blah' }
nodelist.first.trigger :click

session.request.url # => '/blah'
session.response.ok? # => true

# fancy stuff, just builds on the stuff above!

session.click_link 'a cute link'
session.click_button 'an awesome button'
session.within '#foo' do
  click_link 'a cute link'
end
session.fill_in 'foo', :with => 'bar'
session.choose 'Monkey'
session.check 'I am awesome'
session.wait_for '#fooo"

# In cuke:

When 'I am awesome' do
  page.check 'I am awesome'
  page.click_button 'FooBar'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capybara-0.1.1 examples/webcat.rb
capybara-0.1 examples/webcat.rb