• Appium入门(5)__ Appium测试用例(1)


    步骤为:启动AVD、启动Appium、写用例(python)、执行

    一、启动Android模拟器

                     

    二、启动Appium Server

    双击appium图标启动,配置appium的Android Settings,将PlatformVersion对应AVD配置中的target;Device Name对应AVD中的AVD Name

    General Settings保持默认就好

    点击右上角启动Appium,默认占用本机的4723端口,即:127.0.0.1:4723

     三、编写python代码 

    在Notepad或者python编辑器中编写代码

    #coding=utf-8  
    from appium import webdriver  
      
    desired_caps = {}  
    desired_caps['platformName'] = 'Android'  
    desired_caps['platformVersion'] = '5.0.1'  
    desired_caps['deviceName'] = 'Android Emulator'  
    desired_caps['appPackage'] = 'com.android.calculator2'  
    desired_caps['appActivity'] = '.Calculator'  
      
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)  
      
    driver.find_element_by_name("1").click()  
      
    driver.find_element_by_name("5").click()  
      
    driver.find_element_by_name("9").click()  
      
    driver.find_element_by_name("delete").click()  
      
    driver.find_element_by_name("9").click()  
      
    driver.find_element_by_name("5").click()  
      
    driver.find_element_by_name("+").click()  
      
    driver.find_element_by_name("6").click()  
      
    driver.find_element_by_name("=").click()  
      
    driver.quit() 

    四、运行

    cmd中输入 python d:mk est.py,运行的应用是android自带的计算器。

  • 相关阅读:
    认识SQL
    Redis应用场景
    泛型
    数据库多表连接查询的实现方式
    Spring中常用注解及其作用
    flask-路转换器
    CSS初始化样式
    python 中的__str__ 和__repr__方法
    python的map、reduce和filter(过滤器)函数(廖雪峰老师python基础)
    python的迭代器(转自廖雪峰老师python基础)
  • 原文地址:https://www.cnblogs.com/happy-xiaoxiao/p/8365439.html
Copyright © 2020-2023  润新知