Appium自动化(16):Appium常用操作之H5页面操作 --待补充!

手机chrome浏览器操作:

  手机端chrome浏览器一般用于打开H5手机版网站,它的操作方式与PC端的浏览器操作(即selenium对浏览器的操作)是一模一样的,由于切换后的WebView页面也属于网页

下述的方法中部分支持在webview页面中使用:

1、get(self,url):打开网站,url参数为url地址,必须包含http/https前缀
2、refresh(self):刷新当前网页
3、back(self):浏览器后退操作
4、forward(self):浏览器前进
5、close(self):浏览器退出
6、get_screenshot_as_file(self,filename):截图操作
7、page_source(self):获取页面源代码
8、switch_to.frame(self,frame_reference):切换frame框架页
9、switch_to.default_content(self):切换到默认的frame框架页(主页)
10、current_window_handle(self):获取当前窗口句柄值
11、window_handles(self):获取所有窗口的句柄值
12、switch_to.window(self,window_name):切换窗口,window_name填写要切换窗口的句柄值
13、execute_script(self,script,*args):在网页中注入JavaScript片段

代码示例:

后续补充!

猜你喜欢

转载自blog.csdn.net/YouJeffrey/article/details/130915931