Class: Appium::Capybara::Node
- Inherits:
-
Capybara::Driver::Node
- Object
- Capybara::Driver::Node
- Appium::Capybara::Node
- Defined in:
- lib/appium_capybara/driver/appium/node.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](name) ⇒ Object
- #click ⇒ Object
- #disabled? ⇒ Boolean
- #find_css(locator) ⇒ Object
- #find_custom(finder, locator) ⇒ Object
- #find_xpath(locator) ⇒ Object
- #inspect ⇒ Object
- #label ⇒ Object
- #long_press ⇒ Object
- #name ⇒ Object
- #selected? ⇒ Boolean
- #send_keys(value) ⇒ Object
- #set(value) ⇒ Object
- #tag_name ⇒ Object
- #value ⇒ Object
- #visible? ⇒ Boolean
Instance Method Details
#==(other) ⇒ Object
70 71 72 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 70 def ==(other) native == other.native end |
#[](name) ⇒ Object
3 4 5 6 7 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 3 def [](name) native.attribute(name.to_s) rescue Selenium::WebDriver::Error::WebDriverError nil end |
#click ⇒ Object
30 31 32 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 30 def click native.click end |
#disabled? ⇒ Boolean
54 55 56 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 54 def disabled? !native.enabled? end |
#find_css(locator) ⇒ Object
62 63 64 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 62 def find_css(locator) native.find_elements(:css, locator).map { |n| self.class.new(driver, n) } end |
#find_custom(finder, locator) ⇒ Object
66 67 68 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 66 def find_custom(finder, locator) native.find_elements(finder, locator).map { |n| self.class.new(driver, n) } end |
#find_xpath(locator) ⇒ Object
58 59 60 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 58 def find_xpath(locator) native.find_elements(:xpath, locator).map { |n| self.class.new(driver, n) } end |
#inspect ⇒ Object
74 75 76 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 74 def inspect %(#<#{self.class} name="#{name}">) end |
#label ⇒ Object
13 14 15 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 13 def label native.label end |
#long_press ⇒ Object
34 35 36 37 38 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 34 def long_press action = Appium::TouchAction.new action.long_press(element: native, duration: 2000) action.perform end |
#name ⇒ Object
17 18 19 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 17 def name native.name end |
#selected? ⇒ Boolean
49 50 51 52 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 49 def selected? selected = native.selected? selected && selected != "false" end |
#send_keys(value) ⇒ Object
26 27 28 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 26 def send_keys(value) native.send_keys(value.to_s) end |
#set(value) ⇒ Object
21 22 23 24 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 21 def set(value) native.clear send_keys(value) end |
#tag_name ⇒ Object
40 41 42 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 40 def tag_name native.tag_name end |
#value ⇒ Object
9 10 11 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 9 def value native.value end |
#visible? ⇒ Boolean
44 45 46 47 |
# File 'lib/appium_capybara/driver/appium/node.rb', line 44 def visible? displayed = native.displayed? displayed && displayed != "false" end |