春衣少年当酒歌,起舞四顾以笑和。这篇文章主要讲述Appium 计算器自动化实例相关的知识,希望能为你提供帮助。
#coding=utf-8
import os
import time
import unittest
from appium import webdriver
from lib2to3.pgen2.driver import Driver
from lib2to3.tests.support import driver
PATH=lambda p:os.path.abspath(os.path.join(os.path.dirname(__file__),p))
desired_caps = {}
desired_caps[‘platformName‘] = ‘android‘
desired_caps[‘platformVersion‘] = ‘4.4.2‘
desired_caps[‘deviceName‘] = ‘HUAWEI C199‘
【Appium 计算器自动化实例】#desired_caps[‘app‘] = PATH(‘D:\Appium\StarZone_V2.0.0.apk‘)
desired_caps[‘appPackage‘] = ‘com.android.calculator2‘
desired_caps[‘appActivity‘] = ‘.Calculator‘
driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)
#time.sleep(5)
driver.find_element_by_id("com.android.calculator2:id/clear").click()
driver.find_element_by_name("1").click()
driver.find_element_by_name("5").click()
driver.find_element_by_id("com.android.calculator2:id/plus").click()
driver.find_element_by_name("6").click()
driver.find_element_by_id("com.android.calculator2:id/equal").click()
driver.quit()
推荐阅读
- 微信扫一扫二维码跳转手机默认浏览器打开下载app的链接是怎么实现的
- spring_03ApplicationContext三种经常用到的实现
- Trapping Rain Water LT42
- 安卓adb常用命令
- 在Intellij IDEA里面配置Tomcat和Websphere Application Server
- 安卓环境安装(ADK,ADB)
- MyBatisMapper XML 文件
- 在 Windows 上搭建基于Android Studio 3.2 的 Flutter 开发环境
- Java android DES+Base64加密解密