80,349
社区成员
发帖
与我相关
我的任务
分享
import unittest
from appium import webdriver
class MyTestCase(unittest.TestCase):
dc = {}
driver = None
def setUp(self):
# desired_caps = {
# 'appPackage': 'com.experitest.ExperiBank',
# 'appActivity': '.LoginActivity',
# 'platformName': 'Android',
# 'deviceName': 'Android Emulator',
# }
self.dc['app'] = "D:\\CLX\\Android\\eribank.apk"
self.dc['appPackage'] = "com.experitest.ExperiBank"
self.dc['appActivity'] = ".LoginActivity"
self.dc['platformName'] = 'Android'
# self.dc['deviceName'] = 'a3ae1c63'
self.dc['deviceName'] = 'Android Emulator'
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", self.dc)
def testFirstAutomationTest(self):
if len(self.driver.find_elements_by_xpath("//*[@text='OK']")) > 0:
self.driver.find_element_by_xpath("//*[@text='OK']").click()
print("OK click")
self.driver.find_element_by_xpath("//*[@text='Username']").send_keys('company')
self.driver.find_element_by_xpath("//*[@text='Password']").send_keys('company')
self.driver.find_element_by_xpath("//*[@text='Login']").click()
def tearDown(self):
# self.driver.quit()
pass
if __name__ == '__main__':
unittest.main()