I am trying to automate a hybrid mobile app and I have been reading around and to automate a hybrid app I need to be using both the webview and native view.
Currently using appium_lib in conjunction with Ruby and Cucumber.
I run @driver.available_contexts
and I get => ["NATIVE_APP", "WEBVIEW_59846.1"]
.
However when I try and switch to the webview @driver.switch_to.context(webview)
I get the following error message
NoMethodError: undefined method `switch_to' for #<Appium::Driver:0x007f9c4f236958>
Can somebody please advise where I am going wrong? will I need a specific gem for this method?
As the error points out, there is no switch_to
method in Appium::Driver
class.
I think you are looking for set_context
method:
@driver.set_context(webview)
This assumes that webview
has been set with the proper value (i.e. webview = "WEBVIEW_59846.1"
).