Module: Appium::Core::Base::Device::Context
- Included in:
- Bridge::MJSONWP, Bridge::W3C
- Defined in:
- lib/appium_lib_core/common/device/context.rb
Instance Method Summary collapse
- #available_contexts ⇒ Object
- #current_context ⇒ Object
- #set_context(context = null) ⇒ Object
- #switch_to_default_context ⇒ Object
- #within_context(context) ⇒ Object
Instance Method Details
#available_contexts ⇒ Object
26 27 28 29 |
# File 'lib/appium_lib_core/common/device/context.rb', line 26 def available_contexts # return empty array instead of nil on failure execute(:available_contexts, {}) || [] end |
#current_context ⇒ Object
22 23 24 |
# File 'lib/appium_lib_core/common/device/context.rb', line 22 def current_context execute :current_context end |
#set_context(context = null) ⇒ Object
31 32 33 |
# File 'lib/appium_lib_core/common/device/context.rb', line 31 def set_context(context = null) execute :set_context, {}, name: context end |
#switch_to_default_context ⇒ Object
18 19 20 |
# File 'lib/appium_lib_core/common/device/context.rb', line 18 def switch_to_default_context set_context nil end |
#within_context(context) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/appium_lib_core/common/device/context.rb', line 6 def within_context(context) existing_context = current_context set_context context if block_given? result = yield set_context existing_context result else set_context existing_context end end |