Class: Selenium::WebDriver::Element
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Element
- Includes:
- Appium::Core::Base::SearchContext
- Defined in:
- lib/appium_lib_core/patch.rb
Overview
Implement useful features for element. Patch for Selenium Webdriver.
Constant Summary
Constants included from Appium::Core::Base::SearchContext
Appium::Core::Base::SearchContext::FINDERS
Instance Method Summary collapse
-
#location_rel(driver) ⇒ ::Selenium::WebDriver::Point
For use with location_rel.
-
#method_missing(method_name) ⇒ String
Returns the value of attributes like below.
- #respond_to_missing? ⇒ Boolean
Methods included from Appium::Core::Base::SearchContext
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ String
Returns the value of attributes like below. Read each platform to know more details.
checkable, checked, class, clickable, content-desc, enabled, focusable, focused
long-clickable, package, password, resource-id, scrollable, selection-start, selection-end
selected, text, bounds, index
XCUITest automation name supports below attributes.
UID, accessibilityContainer, accessible, enabled, frame,
label, name, rect, type, value, visible, wdAccessibilityContainer,
wdAccessible, wdEnabled, wdFrame, wdLabel, wdName, wdRect, wdType,
wdUID, wdValue, wdVisible
31 32 33 34 35 36 |
# File 'lib/appium_lib_core/patch.rb', line 31 def method_missing(method_name) ignore_list = [:to_hash] return if ignore_list.include? method_name respond_to?(method_name) ? attribute(method_name.to_s.tr('_', '-')) : super end |
Instance Method Details
#location_rel(driver) ⇒ ::Selenium::WebDriver::Point
For use with location_rel.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/appium_lib_core/patch.rb', line 54 def location_rel(driver) rect = self.rect location_x = rect.x.to_f location_y = rect.y.to_f size_width = rect.width.to_f size_height = rect.height.to_f center_x = location_x + (size_width / 2.0) center_y = location_y + (size_height / 2.0) w = driver.window_size ::Selenium::WebDriver::Point.new "#{center_x} / #{w.width.to_f}", "#{center_y} / #{w.height.to_f}" end |
#respond_to_missing? ⇒ Boolean
38 39 40 |
# File 'lib/appium_lib_core/patch.rb', line 38 def respond_to_missing?(*) true end |