Appium 计算器自动化实例

春衣少年当酒歌,起舞四顾以笑和。这篇文章主要讲述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()
 


















    推荐阅读