Appium 计算器自动化实例

Posted 不知道名字

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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‘

#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 计算器自动化实例的主要内容,如果未能解决你的问题,请参考以下文章

appium自动化的一个实例

软件测试进阶之自动化测试——python+appium实例

python+appium app自动化的方法实例运用

(appium+python)UI自动化_07_UI自动化实例拼多多搜索商品为例

基于Appium的APP自动化测试基础--美团APP的实例

我的第一个appium+Python自动化实例