96 lines
1.4 KiB
Markdown
96 lines
1.4 KiB
Markdown
Navigating
|
|
----------
|
|
|
|
visit articles_path
|
|
|
|
Clicking links and buttons
|
|
--------------------------
|
|
|
|
click 'Link Text'
|
|
click_button
|
|
click_link
|
|
|
|
Interacting with forms
|
|
----------------------
|
|
|
|
attach_file
|
|
fill_in 'First Name', :with => 'John'
|
|
check
|
|
uncheck
|
|
choose
|
|
select
|
|
unselect
|
|
|
|
Querying
|
|
--------
|
|
|
|
Takes a CSS selector (or XPath if you're into that).
|
|
Translates nicely into RSpec matchers:
|
|
|
|
page.should have_no_button("Save")
|
|
|
|
Use should have_no_* versions with RSpec matchers b/c
|
|
should_not doesn't wait for a timeout from the driver
|
|
|
|
page.has_content?
|
|
page.has_css?
|
|
page.has_no_content?
|
|
page.has_no_css?
|
|
page.has_no_xpath?
|
|
page.has_xpath?
|
|
page.has_link?
|
|
page.has_no_link?
|
|
page.has_button?("Update")
|
|
page.has_no_button?
|
|
page.has_field?
|
|
page.has_no_field?
|
|
page.has_checked_field?
|
|
page.has_unchecked_field?
|
|
page.has_no_table?
|
|
page.has_table?
|
|
page.has_select?
|
|
page.has_no_select?
|
|
|
|
Finding
|
|
-------
|
|
|
|
find
|
|
find_button
|
|
find_by_id
|
|
find_field
|
|
find_link
|
|
locate
|
|
|
|
Scoping
|
|
-------
|
|
|
|
within
|
|
within_fieldset
|
|
within_table
|
|
within_frame
|
|
scope_to
|
|
|
|
Scripting
|
|
---------
|
|
|
|
execute_script
|
|
evaluate_script
|
|
|
|
Debugging
|
|
---------
|
|
|
|
save_and_open_page
|
|
|
|
Miscellaneous
|
|
-------------
|
|
|
|
all
|
|
body
|
|
current_url
|
|
drag
|
|
field_labeled
|
|
source
|
|
wait_until
|
|
current_path
|
|
|