Appium自动化(15):Appium常用操作之混合应用webview页面操作--待补充!

上下文操作:

  在appium中,对于混合应用,需要进行WebView页面和原生应用的切换

 常用的方法如下:

1、context(self) / current_context(self):返回当前会话的当前上下文,context可以理解为可进入的窗口。对于原生应用,可用的context和默认context均为“NATIVE_APP”,对于      webview页面,context值一般以“webview”开头

2、contexts(self): 列出所有的可用上下文,为从原生应用切换到WebView页面做准备

3、switch_to.context(self,context_name): 切换上下文,context_name参数填写context值,即可在混合应用的原生部分和webview部分进行切换

代码示例:

后续补充!

猜你喜欢

转载自blog.csdn.net/YouJeffrey/article/details/130915917
今日推荐