zoukankan      html  css  js  c++  java
  • Appium 常见API 一

    1.app 的安装与卸载

    driver.install_app(apk path):安装app

    driver.remove_app(app package  name):卸载app

    driver.is_app_installed(app package  name):判断app是否已安装,已安装返回true

    2.关闭和启动app

    driver.close_app()

    driver.launch_app()

    3.将app放置后台n秒,n秒后,页面自动回到前台

    driver.background_app( n  )

    4.获取当前页面 和 启动指定页面

    driver.current_activity()

    driver.start_activity(包名,activity名)

    可以使用在这样的场景中,如果当前页面是登录页就登录,否则先打开登录页再登录:

    if driver.current_activity()==登录页面:

      //...进行登录操作

    else:

      driver.start_activity(包名,登录页面)

    5.等待某个页面出现

    driver.wait_activity('.CustomLocaleActivity',3,1):等待3秒,每1秒检查一次,页面出现则返回true

    6.获取当前页面的树形结构源码

    driver.page_source

    7.截图 :driver.get_screenshot_as_file("我的.png")

    8.获取所有的contexts:  driver.contexts

    获取当前页面的context: driver.current_context

    9.获取当前屏幕的大小

    width=self.driver.get_window_size()['width']

    height=self.driver.get_window_size()['height']

  • 相关阅读:
    spring容器启动
    springmvc流程
    bean作用域
    bean的生命周期
    web.xml详解
    设计模式 工厂和抽象工厂
    requests 模块
    爬虫基础
    提高级
    循环语句
  • 原文地址:https://www.cnblogs.com/iamshasha/p/11089650.html
Copyright © 2011-2022 走看看