forked from happyjared/python-learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoulium.py
More file actions
72 lines (61 loc) · 2.15 KB
/
Copy pathsoulium.py
File metadata and controls
72 lines (61 loc) · 2.15 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
# @author : jared
# @date : 2018/11/10 22:48
import time
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
def auth():
ask = wait.until(EC.presence_of_element_located((By.ID, 'com.android.packageinstaller:id/do_not_ask_checkbox')))
ask.click()
allow = wait.until(
EC.presence_of_element_located((By.ID, 'com.android.packageinstaller:id/permission_allow_button')))
allow.click()
server = 'http://localhost:4723/wd/hub'
desired_caps = {
"platformName": "Android",
"deviceName": "WAS_AL00",
"appPackage": "cn.soulapp.android",
"appActivity": "cn.soulapp.android.ui.splash.SplashActivity"
}
driver = webdriver.Remote(server, desired_caps)
wait = WebDriverWait(driver, 10)
# 1.动画页
skip = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/llSkip')))
skip.click()
# 2.进入页
into = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/btn_newUser')))
into.click()
# 3.账号页
phone = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/etPhone')))
phone.click()
phone.send_keys('xxx')
confirm = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/rlConfirm')))
confirm.click()
# 4.密码页
password = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/etPwd')))
password.click()
password.send_keys('xxx')
driver.back()
login = wait.until(EC.presence_of_element_located((By.ID, 'cn.soulapp.android:id/tvConfirm')))
login.click()
# 5.授权页
view = wait.until(EC.presence_of_element_located((By.ID, "cn.soulapp.android:id/textView2")))
view.click()
auth()
view = wait.until(EC.presence_of_element_located((By.ID, "cn.soulapp.android:id/textView3")))
view.click()
auth()
driver.tap([(511, 931)])
auth()
driver.tap([(529, 1333)])
auth()
# 6.广场界面
square = wait.until(EC.presence_of_element_located((By.ID, "cn.soulapp.android:id/lotSquare")))
square.click()
auth()
driver.tap([(672, 149)])
time.sleep(20)
while True:
driver.swipe(1000, 1400, 1000, 400, 300)