Class: Appium::Core::ImageElement
- Inherits:
-
Object
- Object
- Appium::Core::ImageElement
- Defined in:
- lib/appium_lib_core/element/image.rb
Overview
ImageElement is an element for images by ‘find_element/s_by_image` Experimental feature
Defined Under Namespace
Classes: Dimension, Point, Rectangle
Instance Attribute Summary collapse
-
#visual ⇒ Object
readonly
Base64ed format.
Instance Method Summary collapse
- #all(full_image:, partial_image:, match_threshold: nil, visualize: false) ⇒ Object
-
#click ⇒ Object
Click this element.
- #displayed? ⇒ Boolean
-
#first(full_image:, partial_image:, match_threshold: nil, visualize: false) ⇒ Object
——————————– sugar ——————————–.
-
#initialize(bridge, x, y, width, height, visual = nil) ⇒ ImageElement
constructor
A new instance of ImageElement.
-
#location ⇒ Point
Get the location of this element.
-
#rect ⇒ Rectangle
Get the dimensions and coordinates of this element.
-
#size ⇒ Dimension
Get the size of this element.
Constructor Details
#initialize(bridge, x, y, width, height, visual = nil) ⇒ ImageElement
Returns a new instance of ImageElement.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/appium_lib_core/element/image.rb', line 19 def initialize(bridge, x, y, width, height, visual = nil) @bridge = bridge @visual = visual @center_x = x + width / 2 @center_y = y + height / 2 @x = x @y = y @width = width @height = height end |
Instance Attribute Details
#visual ⇒ Object (readonly)
Base64ed format
17 18 19 |
# File 'lib/appium_lib_core/element/image.rb', line 17 def visual @visual end |
Instance Method Details
#all(full_image:, partial_image:, match_threshold: nil, visualize: false) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/appium_lib_core/element/image.rb', line 98 def all(full_image:, partial_image:, match_threshold: nil, visualize: false) @bridge.find_elements_by_image(full_image: full_image, partial_image: partial_image, match_threshold: match_threshold, visualize: visualize) end |
#click ⇒ Object
Click this element.
39 40 41 |
# File 'lib/appium_lib_core/element/image.rb', line 39 def click @bridge.action.move_to_location(@center_x, @center_y).click.perform end |
#displayed? ⇒ Boolean
85 86 87 |
# File 'lib/appium_lib_core/element/image.rb', line 85 def displayed? true end |
#first(full_image:, partial_image:, match_threshold: nil, visualize: false) ⇒ Object
——————————– sugar ——————————–
91 92 93 94 95 96 |
# File 'lib/appium_lib_core/element/image.rb', line 91 def first(full_image:, partial_image:, match_threshold: nil, visualize: false) @bridge.find_element_by_image(full_image: full_image, partial_image: partial_image, match_threshold: match_threshold, visualize: visualize) end |
#location ⇒ Point
Get the location of this element.
53 54 55 |
# File 'lib/appium_lib_core/element/image.rb', line 53 def location Point.new @x, @y end |