appium-4:测试小米手机自带的计算器
#coding=utf-8 from appium import webdriver import unittest class TesXiaomiCalc(unittest.TestCase): def setUp(self): desired_caps = { 'platformName':'Android', 'platformVersion':'5.0.2', 'deviceName':'b082512' } desired_caps["unicodeKeyboard"]="True" desired_caps["resetKeyboard"]="True" desired_caps['appPackage'] = 'com.miui.calculator' desired_caps['appActivity'] = '.cal.CalculatorActivity' self.driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps) def testDown(self): self.driver.quit() def test_plus(self): calc='159+95+5=259' ca,res=calc.split('=') for c in ca: if c=='+':c='plus' self.driver.find_element_by_id("btn_%s" %c).click() self.driver.find_element_by_id("btn_equal").click() realStr=self.driver.find_elements_by_class_name("android.widget.TextView")[-2].text self.assertEqual(res,realStr) if __name__=='__main__': si =unittest.TestLoader().loadTestsFromTestCase(TesXiaomiCalc) unittest.TextTestRunner(verbosity=2).run(si)
http://www.up123.cc/22.html
相关推荐
加油奋斗吧 2020-07-04
Dataleon 2020-06-16
jszy 2020-05-31
测试自动化顾问 2020-04-20
RocketJ 2020-03-03
ipioneer 2019-12-26
lucialee 2019-12-02
Testingba工作室 2019-11-11
goodby 2019-11-07
dotstar 2017-06-08
Jfuture 2017-05-11
Jfuture 2015-03-22
HappinessCat 2015-01-21
jszy 2013-02-17
buyaofengwohao 2017-06-13
Mrsandman 2016-03-17
指尖 2010-05-18
goodby 2019-06-29
liuuil0 2014-04-28