Class: Capybara::Driver::Selenium::Node
- Inherits:
-
Node
- Object
- Node
- Capybara::Driver::Selenium::Node
show all
- Defined in:
- lib/capybara/driver/selenium_driver.rb
Instance Attribute Summary
Attributes inherited from Node
#driver, #node
Instance Method Summary
collapse
Methods inherited from Node
#initialize, #path, #value
Methods included from Searchable
#all, #find, #find_button, #find_by_id, #find_field, #find_link
Constructor Details
This class inherits a constructor from Capybara::Node
Instance Method Details
#[](name) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/capybara/driver/selenium_driver.rb', line 9
def [](name)
if name == :value
node.value
else
node.attribute(name)
end
rescue Selenium::WebDriver::Error::WebDriverError
nil
end
|
#click ⇒ Object
34
35
36
|
# File 'lib/capybara/driver/selenium_driver.rb', line 34
def click
node.click
end
|
#drag_to(element) ⇒ Object
38
39
40
|
# File 'lib/capybara/driver/selenium_driver.rb', line 38
def drag_to(element)
node.drag_and_drop_on(element.node)
end
|
#select(option) ⇒ Object
30
31
32
|
# File 'lib/capybara/driver/selenium_driver.rb', line 30
def select(option)
node.find_element(:xpath, ".//option[contains(.,'#{option}')]").select
end
|
#set(value) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/capybara/driver/selenium_driver.rb', line 19
def set(value)
if tag_name == 'textarea' or (tag_name == 'input' and %w(text password hidden file).include?(type))
node.clear
node.send_keys(value.to_s)
elsif tag_name == 'input' and type == 'radio'
node.select
elsif tag_name == 'input' and type == 'checkbox'
node.toggle
end
end
|
#tag_name ⇒ Object
42
43
44
|
# File 'lib/capybara/driver/selenium_driver.rb', line 42
def tag_name
node.tag_name
end
|
#text ⇒ Object
5
6
7
|
# File 'lib/capybara/driver/selenium_driver.rb', line 5
def text
node.text
end
|
#visible? ⇒ Boolean
46
47
48
|
# File 'lib/capybara/driver/selenium_driver.rb', line 46
def visible?
node.displayed? and node.displayed? != "false"
end
|