• 第一个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最简单的应用了。

  • 相关阅读:
    JS 数组去重复值
    git 上传项目 到github
    IntelliJ IDEA 创建maven 项目 并且,将springMVC 与Mybatis 整合
    easyui datagrid 动态添加columns属性
    codeMirror的简单使用,js比较文本差异(标注出增删改)
    sql注入
    Web For Pentester靶场
    一些数据库
    nginx的使用场景
    dockerfile
  • 原文地址:https://www.cnblogs.com/mgzc-1508873480/p/8277169.html
Copyright © 2020-2023  润新知