forked from syx1990/auto-watch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.py
38 lines (31 loc) · 771 Bytes
/
test1.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
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: UTF-8 -*-
from appium import webdriver
import time
print("配置基础信息")
cap = {
"platformName": "Android",
"platformVersion": "9",
"deviceName": "2911a8d0",
"udid": "2911a8d0",
"appPackage": "com.jm.video",
"appActivity": "com.jm.video.ui.main.SplashActivity",
"noReset": True
}
driver = webdriver.Remote("http://localhost:4723/wd/hub", cap)
def get_size():
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
return (x, y)
l = get_size()
x1 = int(l[0] * 0.5)
y1 = int(l[1] * 0.75)
y2 = int(l[1] * 0.25)
num = 0
while True:
try:
driver.swipe(x1, y1, x1, y2)
num += 1
time.sleep(12)
print("小视频跑了%d次" % num)
except:
pass