-
Notifications
You must be signed in to change notification settings - Fork 0
/
appium_test.py
24 lines (23 loc) · 959 Bytes
/
appium_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from appium import webdriver
import time
desired_capabilities= {}
desired_capabilities['platformName'] = 'Android'
desired_capabilities['platformVersion'] = '8'
desired_capabilities['deviceName'] = 'test'
desired_capabilities['appPackage']= 'com.android.calculator2'
desired_capabilities['app'] = ''
desired_capabilities['appActivity'] = '.Calculator'
desired_capabilities['unicodeKeyboard'] = True
desired_capabilities['resetKeyboard'] = True
desired_capabilities['noReset'] = True
desired_capabilities['fullReset'] = False
print(desired_capabilities)
driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_capabilities)
driver.implicitly_wait(10)
driver.find_element_by_id('com.android.calculator2:id/digit_1').click()
time.sleep(1)
driver.find_element_by_accessibility_id('加').click()
time.sleep(1)
driver.find_element_by_id('com.android.calculator2:id/digit_3').click()
time.sleep(1)
driver.find_element_by_accessibility_id('等于').click()