zoukankan      html  css  js  c++  java
  • 第一个appium脚本

    本篇简单介绍一下用UtraEdit编写自动化脚本的方法。

    在计算机任意一个目录下,新建hello_appium.py文件,把 Appium-Python-Client-0.25.tar.gz 和 selenium-3.8.0.tar.gz 解压出来的 appium 文件夹和 selenium 文件夹放到和hello_appium.py同级的目录下,然后就可以开始写代码了。

     1 from appium import webdriver
     2 import time
     3  
     4 desired_caps={}
     5 desired_caps['platformName']='Android'
     6 desired_caps['platformVersion']='4.4.2'
     7 desired_caps['deviceName']='7N2SSE158P001892'
     8 desired_caps['noReset']='noReset'
     9 desired_caps['appPackage']='com.gomo.calculator'
    10 desired_caps['appActivity']='.ui.activity.MainActivity'
    11 driver=webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)  #实例化driver
    12 self.driver.implicitly_wait(10)  #设置隐式等待时间
    13 
    14 driver.find_element_by_id("com.gomo.calculator:id/input_num_1").click()
    15 driver.find_element_by_id("com.gomo.calculator:id/input_num_5").click()
    16 driver.find_element_by_id("com.gomo.calculator:id/display_op_add").click()
    17 driver.find_element_by_id("com.gomo.calculator:id/input_num_6").click()
    18 driver.find_element_by_id("com.gomo.calculator:id/display_eq").click()
    19 driver.quit()

    运行方法:

    打开cmd,输入python hello_appium.py(最好输入完整路径),回车

    这就是appium最简单的应用了。

  • 相关阅读:
    POJ 2892 Tunnel Warfare(树状数组+二分)
    POJ 2886 Who Gets the Most Candies?(树状数组+二分)
    POJ 2492 A Bug's Life(并查集)
    POJ 1182 食物链(并查集)
    POJ 1703 Find them, Catch them(种类并查集)
    TC SRM 582 DIV 2
    函数
    shell进阶--流程
    计划任务 at,cron
    kill命令
  • 原文地址:https://www.cnblogs.com/mgzc-1508873480/p/8277169.html
Copyright © 2011-2022 走看看