码迷,mamicode.com
首页 > 移动开发 > 详细

Appium 计算器自动化实例

时间:2019-02-10 12:16:01      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:oca   clear   lambda   form   one   and   join   local   path   

#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‘

#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()

 

Appium 计算器自动化实例

标签:oca   clear   lambda   form   one   and   join   local   path   

原文地址:https://www.cnblogs.com/bzdmz/p/10358898.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!