Class: Appium::Core::Base::CoreBridgeW3C
- Inherits:
-
Selenium::WebDriver::Remote::W3C::Bridge
- Object
- Selenium::WebDriver::Remote::W3C::Bridge
- Appium::Core::Base::CoreBridgeW3C
- Defined in:
- lib/appium_lib_core/common/base/w3c_bridge.rb
Instance Method Summary collapse
-
#action(async = false) ⇒ Object
(also: #actions)
Perform touch actions for W3C module.
- #commands(command) ⇒ Object
-
#element_attribute(element, name) ⇒ Object
For Appium override.
-
#find_element_by(how, what, parent = nil) ⇒ Object
For Appium override.
-
#find_elements_by(how, what, parent = nil) ⇒ Object
For Appium override.
-
#location ⇒ Object
For Appium override.
-
#network_connection ⇒ Object
For Appium override.
-
#network_connection=(type) ⇒ Object
For Appium override.
-
#page_source ⇒ Object
For Appium override.
-
#set_location(lat, lon, alt) ⇒ Object
For Appium override.
Instance Method Details
#action(async = false) ⇒ Object Also known as: actions
Perform touch actions for W3C module. Generate ‘touch` pointer action here and users can use this via `driver.action`
-
seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
-
seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/PointerActions.html
-
seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/KeyActions.html
For Appium override
27 28 29 30 31 32 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 27 def action(async = false) ::Selenium::WebDriver::W3CActionBuilder.new self, ::Selenium::WebDriver::Interactions.pointer(:touch, name: 'touch'), ::Selenium::WebDriver::Interactions.key('keyboard'), async end |
#commands(command) ⇒ Object
9 10 11 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 9 def commands(command) ::Appium::Core::Commands::COMMANDS_EXTEND_W3C[command] end |
#element_attribute(element, name) ⇒ Object
For Appium override
47 48 49 50 51 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 47 def element_attribute(element, name) # For W3C # execute_atom :getAttribute, element, name execute :get_element_attribute, id: element.ref, name: name end |
#find_element_by(how, what, parent = nil) ⇒ Object
For Appium override
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 55 def find_element_by(how, what, parent = nil) how, what = convert_locators(how, what) id = if parent execute :find_child_element, { id: parent }, { using: how, value: what } else execute :find_element, {}, { using: how, value: what } end ::Selenium::WebDriver::Element.new self, element_id_from(id) end |
#find_elements_by(how, what, parent = nil) ⇒ Object
For Appium override
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 68 def find_elements_by(how, what, parent = nil) how, what = convert_locators(how, what) ids = if parent execute :find_child_elements, { id: parent }, { using: how, value: what } else execute :find_elements, {}, { using: how, value: what } end ids.map { |id| ::Selenium::WebDriver::Element.new self, element_id_from(id) } end |
#location ⇒ Object
For Appium override
82 83 84 85 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 82 def location obj = execute(:get_location) || {} Location.new obj['latitude'], obj['longitude'], obj['altitude'] end |
#network_connection ⇒ Object
For Appium override
96 97 98 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 96 def network_connection execute :get_network_connection end |
#network_connection=(type) ⇒ Object
For Appium override
102 103 104 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 102 def network_connection=(type) execute :set_network_connection, {}, { parameters: { type: type } } end |
#page_source ⇒ Object
For Appium override
37 38 39 40 41 42 43 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 37 def page_source # For W3C # execute_script('var source = document.documentElement.outerHTML;' # 'if (!source) { source = new XMLSerializer().serializeToString(document); }' # 'return source;') execute :get_page_source end |
#set_location(lat, lon, alt) ⇒ Object
For Appium override
89 90 91 92 |
# File 'lib/appium_lib_core/common/base/w3c_bridge.rb', line 89 def set_location(lat, lon, alt) loc = { latitude: lat, longitude: lon, altitude: alt } execute :set_location, {}, { location: loc } end |