zoukankan      html  css  js  c++  java
  • (1)Appium基础操作API

    1.安装APK到手机

     driver.install_app(app_path) 
        参数:
            app_path:脚本机器中APK文件路径

    2.手机中移除APP

      driver.remove_app(app_id) 
      参数:
          app_id:需要卸载的app包名
    

    3.判断APP是否已安装

      driver.is_app_installed(bundle_id) 
      参数:
          bundle_id: 可以传入app包名,返回结果为True(已安装) / False(未安装)
    

    4.发送文件到手机

      import base64
      data = str(base64.b64encode(data.encode('utf-8')),'utf-8')
      driver.push_file(path,data)
      参数:
          path:手机设备上的路径(例如:/sdcard/a.txt)
          data:文件内数据,要求base64编码
          Python3.x中字符都为unicode编码,而b64encode函数的参数为byte类型,需要先转码;
           生成的数据为byte类型,需要将byte转换回去。

    5.从手机中拉取文件

      import base64
      data = driver.pull_file(path) # 返回数据为base64编码
      print(str(base64.b64decode(data),'utf-8')) # base64解码
      参数:
          path: 手机设备上的路径
    

    6.获取当前屏幕内元素结构

      driver.page_source  
      作用:
          返回当前页面的文档结构,判断特定的元素是否存在
  • 相关阅读:
    nyoj151——中国剩余定理
    nyoj最少乘法次数——快速幂思想
    中国剩余定理——nyoj
    尼姆博弈
    威佐夫博弈——hdu1527
    巴什博奕——hdu2149
    struts OGNL详解
    Ognl对象图导航语言 源码
    valuestack 根对象CompoundRoot 源码
    ServletActionContext 源码
  • 原文地址:https://www.cnblogs.com/crystal1126/p/12332231.html
Copyright © 2011-2022 走看看