Class: Appium::Capybara::Node

Inherits:
Capybara::Driver::Node
  • Object
show all
Defined in:
lib/appium_capybara/driver/appium/node.rb

Instance Method Summary collapse

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

#clickObject



30
31
32
# File 'lib/appium_capybara/driver/appium/node.rb', line 30

def click
  native.click
end

#disabled?Boolean

Returns:

  • (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

#inspectObject



74
75
76
# File 'lib/appium_capybara/driver/appium/node.rb', line 74

def inspect
  %(#<#{self.class} name="#{name}">)
end

#labelObject



13
14
15
# File 'lib/appium_capybara/driver/appium/node.rb', line 13

def label
  native.label
end

#long_pressObject



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

#nameObject



17
18
19
# File 'lib/appium_capybara/driver/appium/node.rb', line 17

def name
  native.name
end

#selected?Boolean

Returns:

  • (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_nameObject



40
41
42
# File 'lib/appium_capybara/driver/appium/node.rb', line 40

def tag_name
  native.tag_name
end

#valueObject



9
10
11
# File 'lib/appium_capybara/driver/appium/node.rb', line 9

def value
  native.value
end

#visible?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/appium_capybara/driver/appium/node.rb', line 44

def visible?
  displayed = native.displayed?
  displayed && displayed != "false"
end