我正在尝试自动化混合移动应用程序并且我一直在阅读并自动化我需要同时使用 WebView 和 native View 的混合应用程序。
目前将 appium_lib 与 Ruby 和 Cucumber 结合使用。
我运行 @driver.available_contexts
并得到 => ["NATIVE_APP", "WEBVIEW_59846.1"]
。
但是,当我尝试切换到 webview @driver.switch_to.context(webview)
时,我收到以下错误消息
NoMethodError: undefined method `switch_to' for #<Appium::Driver:0x007f9c4f236958>
有人可以告诉我哪里出错了吗?这种方法需要特定的 gem 吗?
最佳答案
正如错误指出的那样,Appium::Driver
类中没有 switch_to
方法。
我想你在找set_context
方法:
@driver.set_context(webview)
这假定 webview
已设置为正确的值(即 webview = "WEBVIEW_59846.1"
)。
关于android - 无方法错误 : undefined method `switch_to' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44500477/