Class: Capybara::Node::Document
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Base
|
|
|
Instance Chain:
|
|
| Inherits: |
Capybara::Node::Base
|
| Defined in: | lib/capybara/node/document.rb |
Overview
A Capybara::Document represents an Capybara.HTML document. Any operation performed on it will be performed on the entire document.
Constant Summary
Actions - Included
CAPTURE_FILE_ELEMENT_SCRIPT, DATALIST_OPTIONS_SCRIPT, RESET_STYLE_SCRIPT, UPDATE_STYLE_SCRIPT
Class Method Summary
Instance Attribute Summary
Base - Inherited
Instance Method Summary
- #evaluate_script(*args)
- #execute_script(*args)
- #inspect
- #scroll_to(*args, quirks: false, **options)
- #text(type = nil, normalize_ws: false) ⇒ String
- #title ⇒ String
DocumentMatchers - Included
| #assert_no_title | Asserts that the page doesn’t have the given title. |
| #assert_title | Asserts that the page has the given title. |
| #has_no_title? | Checks if the page doesn’t have the given title. |
| #has_title? | Checks if the page has the given title. |
| #_verify_title | |
Base - Inherited
| #reload | overridden in subclasses, e.g. |
| #synchronize | This method is Capybara’s primary defence against asynchronicity problems. |
| #to_capybara_node, #find_css, #find_xpath, #session_options | |
Minitest::Expectations - Included
Matchers - Included
| #==, | |
| #assert_all_of_selectors | Asserts that all of the provided selectors are present on the given page or descendants of the current node. |
| #assert_ancestor | Asserts that a given selector matches an ancestor of the current node. |
| #assert_any_of_selectors | Asserts that any of the provided selectors are present on the given page or descendants of the current node. |
| #assert_matches_selector | Asserts that the current node matches a given selector. |
| #assert_matches_style | Asserts that an element has the specified CSS styles. |
| #assert_no_ancestor, | |
| #assert_no_selector | Asserts that a given selector is not on the page or a descendant of the current node. |
| #assert_no_sibling, | |
| #assert_no_text | Asserts that the page or current node doesn’t have the given text content, ignoring any Capybara.HTML tags. |
| #assert_none_of_selectors | Asserts that none of the provided selectors are present on the given page or descendants of the current node. |
| #assert_not_matches_selector | Asserts that the current node does not match a given selector. |
| #assert_selector | Asserts that a given selector is on the page or a descendant of the current node. |
| #assert_sibling | Asserts that a given selector matches a sibling of the current node. |
| #assert_style, | |
| #assert_text | Asserts that the page or current node has the given text content, ignoring any Capybara.HTML tags. |
| #has_ancestor? | Predicate version of |
| #has_button? | Checks if the page or current node has a button with the given text, value or id. |
| #has_checked_field? | Checks if the page or current node has a radio button or checkbox with the given label, value, id, or test_id attribute that is currently checked. |
| #has_content? | Alias for Matchers#has_text?. |
| #has_css? | Checks if a given CSS selector is on the page or a descendant of the current node. |
| #has_element? | Checks if the page or current node has a element with the given local name. |
| #has_field? | Checks if the page or current node has a form field with the given label, name or id. |
| #has_link? | Checks if the page or current node has a link with the given text or id. |
| #has_no_ancestor? | Predicate version of |
| #has_no_button? | Checks if the page or current node has no button with the given text, value or id. |
| #has_no_checked_field? | Checks if the page or current node has no radio button or checkbox with the given label, value or id, or test_id attribute that is currently checked. |
| #has_no_content? | Alias for Matchers#has_no_text?. |
| #has_no_css? | Checks if a given CSS selector is not on the page or a descendant of the current node. |
| #has_no_element? | Checks if the page or current node has no element with the given local name. |
| #has_no_field? | Checks if the page or current node has no form field with the given label, name or id. |
| #has_no_link? | Checks if the page or current node has no link with the given text or id. |
| #has_no_select? | Checks if the page or current node has no select field with the given label, name or id. |
| #has_no_selector? | Checks if a given selector is not on the page or a descendant of the current node. |
| #has_no_sibling? | Predicate version of |
| #has_no_table? | Checks if the page or current node has no table with the given id or caption. |
| #has_no_text? | Checks if the page or current node does not have the given text content, ignoring any Capybara.HTML tags and normalizing whitespace. |
| #has_no_unchecked_field? | Checks if the page or current node has no radio button or checkbox with the given label, value or id, or test_id attribute that is currently unchecked. |
| #has_no_xpath? | Checks if a given |
| #has_select? | Checks if the page or current node has a select field with the given label, name or id. |
| #has_selector? | Checks if a given selector is on the page or a descendant of the current node. |
| #has_sibling? | Predicate version of |
| #has_style?, | |
| #has_table? | Checks if the page or current node has a table with the given id or caption: |
| #has_text? | Checks if the page or current node has the given text content, ignoring any Capybara.HTML tags. |
| #has_unchecked_field? | Checks if the page or current node has a radio button or checkbox with the given label, value or id, or test_id attribute that is currently unchecked. |
| #has_xpath? | Checks if a given |
| #matches_css? | Checks if the current node matches given CSS selector. |
| #matches_selector? | Checks if the current node matches given selector. |
| #matches_style? | Checks if a an element has the specified CSS styles. |
| #matches_xpath? | Checks if the current node matches given |
| #not_matches_css? | Checks if the current node does not match given CSS selector. |
| #not_matches_selector? | Checks if the current node does not match given selector. |
| #not_matches_xpath? | Checks if the current node does not match given |
| #_set_query_session_options, #_verify_match_result, #_verify_multiple, #_verify_selector_result, #_verify_text, #extract_selector, #make_predicate | |
Actions - Included
| #attach_file | Find a descendant file field on the page and attach a file given its path. |
| #check | Find a descendant check box and mark it as checked. |
| #choose | Find a descendant radio button and mark it as checked. |
| #click_button | Finds a button on the page and clicks it. |
| #click_link | Finds a link by id, test_id attribute, text or title and clicks it. |
| #click_link_or_button | Finds a button or link and clicks it. |
| #click_on | Alias for Actions#click_link_or_button. |
| #fill_in | Locate a text field or text area and fill it in with the given text. |
| #select | If |
| #uncheck | Find a descendant check box and uncheck it. |
| #unselect | Find a select box on the page and unselect a particular option from it. |
| #_check_with_label, #_reset_style, #_update_style, #find_select_or_datalist_input, #select_datalist_option, #while_visible | |
Finders - Included
| #all | Find all elements on the page matching the given selector and options. |
| #ancestor | Find an |
| #find | Find an |
| #find_all | Alias for Finders#all. |
| #find_button | Find a button on the page. |
| #find_by_id | Find a element on the page, given its id. |
| #find_field | Find a form field on the page. |
| #find_link | Find a link on the page. |
| #first | Find the first element on the page matching the given selector and options. |
| #sibling | Find an |
| #ambiguous?, #options_include_minimum?, #parent, #prefer_exact?, #synced_resolve | |
Constructor Details
This class inherits a constructor from Capybara::Node::Base
Instance Method Details
#evaluate_script(*args)
[ GitHub ]# File 'lib/capybara/node/document.rb', line 39
def evaluate_script(*args) find(:xpath, '/html').evaluate_script(*args) end
#execute_script(*args)
[ GitHub ]# File 'lib/capybara/node/document.rb', line 35
def execute_script(*args) find(:xpath, '/html').execute_script(*args) end
#inspect
[ GitHub ]# File 'lib/capybara/node/document.rb', line 15
def inspect %(#<Capybara::Document>) end
#scroll_to(*args, quirks: false, **options)
[ GitHub ]# File 'lib/capybara/node/document.rb', line 43
def scroll_to(*args, quirks: false, **) find(:xpath, quirks ? '//body' : '/html').scroll_to(*args, **) end
#text(type = nil, normalize_ws: false) ⇒ String
# File 'lib/capybara/node/document.rb', line 23
def text(type = nil, normalize_ws: false) find(:xpath, '/html').text(type, normalize_ws: normalize_ws) end
#title ⇒ String
# File 'lib/capybara/node/document.rb', line 31
def title session.driver.title end