Module: Async::WebDriver::Scope::Elements
- Included in:
- Element, Async::WebDriver::Session
- Defined in:
- lib/async/webdriver/scope/elements.rb
Overview
Helpers for finding elements.
Instance Method Summary collapse
-
#children ⇒ Object
Find all children of the current element.
-
#find_element(locator) ⇒ Object
Find an element using the given locator.
-
#find_element_by_css(css) ⇒ Object
Find an element using the given CSS selector.
-
#find_element_by_link_text(text) ⇒ Object
Find an element using the given link text.
-
#find_element_by_partial_link_text(text) ⇒ Object
Find an element using the given partial link text.
-
#find_element_by_tag_name(name) ⇒ Object
Find an element using the given tag name.
-
#find_element_by_xpath(xpath) ⇒ Object
Find an element using the given XPath expression.
-
#find_elements(locator) ⇒ Object
Find all elements using the given locator.
-
#find_elements_by_css(css) ⇒ Object
Find all elements using the given CSS selector.
-
#find_elements_by_link_text(text) ⇒ Object
Find all elements using the given link text.
-
#find_elements_by_partial_link_text(text) ⇒ Object
Find all elements using the given partial link text.
-
#find_elements_by_tag_name(name) ⇒ Object
Find all elements using the given tag name.
-
#find_elements_by_xpath(xpath) ⇒ Object
Find all elements using the given XPath expression.
Instance Method Details
#children ⇒ Object
Find all children of the current element.
103 104 105 |
# File 'lib/async/webdriver/scope/elements.rb', line 103 def children find_elements_by_xpath("./child::*") end |
#find_element(locator) ⇒ Object
Find an element using the given locator. If no element is found, an exception is raised.
15 16 17 |
# File 'lib/async/webdriver/scope/elements.rb', line 15 def find_element(locator) current_scope.post("element", locator) end |
#find_element_by_css(css) ⇒ Object
Find an element using the given CSS selector.
23 24 25 |
# File 'lib/async/webdriver/scope/elements.rb', line 23 def find_element_by_css(css) find_element({using: "css selector", value: css}) end |
#find_element_by_link_text(text) ⇒ Object
Find an element using the given link text.
31 32 33 |
# File 'lib/async/webdriver/scope/elements.rb', line 31 def find_element_by_link_text(text) find_element({using: "link text", value: text}) end |
#find_element_by_partial_link_text(text) ⇒ Object
Find an element using the given partial link text.
39 40 41 |
# File 'lib/async/webdriver/scope/elements.rb', line 39 def find_element_by_partial_link_text(text) find_element({using: "partial link text", value: text}) end |
#find_element_by_tag_name(name) ⇒ Object
Find an element using the given tag name.
47 48 49 |
# File 'lib/async/webdriver/scope/elements.rb', line 47 def find_element_by_tag_name(name) find_element({using: "tag name", value: name}) end |
#find_element_by_xpath(xpath) ⇒ Object
Find an element using the given XPath expression.
55 56 57 |
# File 'lib/async/webdriver/scope/elements.rb', line 55 def find_element_by_xpath(xpath) find_element({using: "xpath", value: xpath}) end |
#find_elements(locator) ⇒ Object
Find all elements using the given locator. If no elements are found, an empty array is returned.
62 63 64 |
# File 'lib/async/webdriver/scope/elements.rb', line 62 def find_elements(locator) current_scope.post("elements", locator) end |
#find_elements_by_css(css) ⇒ Object
Find all elements using the given CSS selector.
69 70 71 |
# File 'lib/async/webdriver/scope/elements.rb', line 69 def find_elements_by_css(css) find_elements({using: "css selector", value: css}) end |
#find_elements_by_link_text(text) ⇒ Object
Find all elements using the given link text.
76 77 78 |
# File 'lib/async/webdriver/scope/elements.rb', line 76 def find_elements_by_link_text(text) find_elements({using: "link text", value: text}) end |
#find_elements_by_partial_link_text(text) ⇒ Object
Find all elements using the given partial link text.
83 84 85 |
# File 'lib/async/webdriver/scope/elements.rb', line 83 def find_elements_by_partial_link_text(text) find_elements({using: "partial link text", value: text}) end |
#find_elements_by_tag_name(name) ⇒ Object
Find all elements using the given tag name.
90 91 92 |
# File 'lib/async/webdriver/scope/elements.rb', line 90 def find_elements_by_tag_name(name) find_elements({using: "tag name", value: name}) end |
#find_elements_by_xpath(xpath) ⇒ Object
Find all elements using the given XPath expression.
97 98 99 |
# File 'lib/async/webdriver/scope/elements.rb', line 97 def find_elements_by_xpath(xpath) find_elements({using: "xpath", value: xpath}) end |