class Object

Public Instance Methods

attribute(name) click to toggle source

Get the value of a the given attribute of the element. @param [String]

attribute name, example: type, label, name, value, rect

@return [String,nil]

attribute value
# File lib/selenium_patch/element_patch.rb, line 54
def attribute(name)
  bridge.element_attribute self, name
end
element_location(element) click to toggle source
# File lib/selenium_patch/bridge_patch.rb, line 26
def element_location(element)
  data = execute :get_element_rect, id: element

  Selenium::WebDriver::Point.new data['x'], data['y']
end
element_rect(element) click to toggle source

Add element_rect method

# File lib/selenium_patch/bridge_patch.rb, line 16
def element_rect(element)
  data = execute :get_element_rect, id: element
  return data
end
element_size(element) click to toggle source
# File lib/selenium_patch/bridge_patch.rb, line 32
def element_size(element)
  data = execute :get_element_rect, id: element

  Selenium::WebDriver::Dimension.new data['width'], data['height']
end
id() click to toggle source
# File lib/selenium_patch/element_patch.rb, line 10
def id
  ref
end
label() click to toggle source

Get element name attribute

# File lib/selenium_patch/element_patch.rb, line 45
def label
  bridge.element_attribute self, 'label'
end
name() click to toggle source

Get element name attribute

# File lib/selenium_patch/element_patch.rb, line 40
def name
  bridge.element_attribute self, 'name'
end
rect() click to toggle source

Get wdRect by id @param id [String] Element uuid @return rect [Hash] location: y, x, size: width, height

# File lib/selenium_patch/element_patch.rb, line 24
def rect
  bridge.element_rect @id
end
scroll(direction) click to toggle source

Scroll on an element with its id @param id [String], direction [String] up, down, left, right @return {}

# File lib/selenium_patch/element_patch.rb, line 17
def scroll(direction)
  bridge.element_scroll self, direction
end
scroll_element(element, direction) click to toggle source

Add element_scroll method

# File lib/selenium_patch/bridge_patch.rb, line 22
def scroll_element(element, direction)
  execute :scroll_element, {id: element}, {direction: direction}
end
tag_name() click to toggle source

Get element type attribute @return [String] example: “XCUIElementTypePageIndicator”, “XCUIElementTypeButton”

# File lib/selenium_patch/element_patch.rb, line 30
def tag_name
  bridge.element_tag_name @id
end
value() click to toggle source

Get element value attribute

# File lib/selenium_patch/element_patch.rb, line 35
def value
  bridge.element_attribute self, 'value'
end