forked from Python3WebSpider/Moments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
26 lines (22 loc) · 806 Bytes
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from appium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
server = 'http://localhost:4723/wd/hub'
desired_caps = {
'platformName': 'Android',
'deviceName': 'MI_NOTE_Pro',
'appPackage': 'com.tencent.mm',
'appActivity': '.ui.LauncherUI'
}
# desired_caps = {
# 'platformName': 'Android',
# 'deviceName': 'MI_NOTE_Pro',
# 'app': './weixin.apk'
# }
driver = webdriver.Remote(server, desired_caps)
wait = WebDriverWait(driver, 30)
login = wait.until(EC.presence_of_element_located((By.ID, 'com.tencent.mm:id/cjk')))
login.click()
phone = wait.until(EC.presence_of_element_located((By.ID, 'com.tencent.mm:id/h2')))
phone.set_text('18888888888')