Class: Selenium::WebDriver::Element
- Defined in:
- lib/appium_lib/common/patch.rb
Overview
Implement useful features for element.
Instance Method Summary collapse
-
#location_rel ⇒ OpenStruct
For use with mobile tap.
-
#name ⇒ Object
Returns the name attribute.
-
#value ⇒ Object
Returns the value attribute.
Instance Method Details
#location_rel ⇒ OpenStruct
For use with mobile tap.
“‘ruby execute_script ’mobile: tap’, :x => 0.0, :y => 0.98 “‘
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/appium_lib/common/patch.rb', line 31 def location_rel location = self.location location_x = location.x.to_f location_y = location.y.to_f size = self.size size_width = size.width.to_f size_height = size.height.to_f center_x = location_x + (size_width / 2.0) center_y = location_y + (size_height / 2.0) w = $driver.window_size OpenStruct.new(x: "#{center_x} / #{w.width.to_f}", y: "#{center_y} / #{w.height.to_f}") end |
#name ⇒ Object
Returns the name attribute
Fixes NoMethodError: undefined method ‘name’ for Selenium::WebDriver::Element
19 20 21 |
# File 'lib/appium_lib/common/patch.rb', line 19 def name attribute :name end |
#value ⇒ Object
Returns the value attribute
Fixes NoMethodError: undefined method ‘value’ for Selenium::WebDriver::Element
12 13 14 |
# File 'lib/appium_lib/common/patch.rb', line 12 def value attribute :value end |