Module: TestaAppiumDriver::Attributes

Included in:
Appium::Core::Element, Locator
Defined in:
lib/testa_appium_driver/ios/locator/attributes.rb,
lib/testa_appium_driver/android/locator/attributes.rb

Instance Method Summary collapse

Instance Method Details

#accessibility_container(*args) ⇒ Object



26
27
28
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 26

def accessibility_container(*args)
  testa_attribute("accessibilityContainer", *args)
end

#accessible?(*args) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 30

def accessible?(*args)
  testa_attribute("accessible", *args).to_s == "true"
end

#checkable?(*args) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 42

def checkable?(*args)
  testa_attribute("checkable", *args).to_s == "true"
end

#checked?(*args) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 46

def checked?(*args)
  testa_attribute("checked", *args).to_s == "true"
end

#class_name(*args) ⇒ Object



35
36
37
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 35

def class_name(*args)
  testa_attribute("class", *args)
end

#clickable?(*args) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 50

def clickable?(*args)
  testa_attribute("clickable", *args).to_s == "true"
end

#desc(*args) ⇒ Object



54
55
56
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 54

def desc(*args)
  testa_attribute("contentDescription", *args)
end

#displayed?(*args) ⇒ Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 90

def displayed?(*args)
  testa_attribute("displayed", *args).to_s == "true"
end

#enabled?(*args) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 39

def enabled?(*args)
  testa_attribute("enabled", *args).to_s == "true"
end

#focusable?(*args) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 62

def focusable?(*args)
  testa_attribute("focusable", *args).to_s == "true"
end

#focused?(*args) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 66

def focused?(*args)
  testa_attribute("focused", *args).to_s == "true"
end

#frame(*args) ⇒ Object



43
44
45
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 43

def frame(*args)
  testa_attribute("frame", *args)
end

#id(*args) ⇒ Object



78
79
80
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 78

def id(*args)
  testa_attribute("resourceId", *args)
end

#index(*args) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 47

def index(*args)
  index = testa_attribute("index", *args)
  index = "1" if index == "true"
  index = "0" if index == "false"

  index
end

#label(*args) ⇒ Object Also known as: text



55
56
57
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 55

def label(*args)
  testa_attribute("label", *args)
end

#long_clickable?(*args) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 70

def long_clickable?(*args)
  testa_attribute("longClickable", *args).to_s == "true"
end

#name(*args) ⇒ Object



59
60
61
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 59

def name(*args)
  testa_attribute("name", *args)
end

#package(*args) ⇒ Object



34
35
36
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 34

def package(*args)
  testa_attribute("package", *args)
end

#password?(*args) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 74

def password?(*args)
  testa_attribute("password", *args).to_s == "true"
end

#rect(*args) ⇒ Object Also known as: bounds



64
65
66
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 64

def rect(*args)
  testa_attribute("rect", *args)
end

#scrollable?(*args) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 82

def scrollable?(*args)
  testa_attribute("scrollable", *args).to_s == "true"
end

#selected?(*args) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 68

def selected?(*args)
  testa_attribute("selected", *args).to_s == "true"
end

#selection_end(*args) ⇒ Object



98
99
100
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 98

def selection_end(*args)
  testa_attribute("selection-end", *args)
end

#selection_start(*args) ⇒ Object



94
95
96
# File 'lib/testa_appium_driver/android/locator/attributes.rb', line 94

def selection_start(*args)
  testa_attribute("selection-start", *args)
end

#testa_attribute(name, *args) ⇒ Object

noinspection RubyNilAnalysis



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 5

def testa_attribute(name, *args)

  if self.instance_of?(::Selenium::WebDriver::Element) || self.instance_of?(::Appium::Core::Element)
    @driver = get_driver
    elements = self
  else
    elements = execute(*args)
  end


  if elements.instance_of?(::Selenium::WebDriver::Element) || elements.instance_of?(::Appium::Core::Element)
    r = elements.send(:attribute, name.to_s)
    r = TestaAppiumDriver::Bounds.from_ios(r, @driver) if name.to_s == "rect"
  else
    r = elements.map { |e| e.send(:attribute, name.to_s) }
    r.map! { |b| TestaAppiumDriver::Bounds.from_ios(b, @driver) } if name.to_s == "rect"
  end
  r
end

#type(*args) ⇒ Object



72
73
74
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 72

def type(*args)
  testa_attribute("type", *args)
end

#value(*args) ⇒ Object



76
77
78
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 76

def value(*args)
  testa_attribute("value", *args)
end

#visible?(*args) ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/testa_appium_driver/ios/locator/attributes.rb', line 80

def visible?(*args)
  testa_attribute("visible", *args).to_s == "true"
end