-
Notifications
You must be signed in to change notification settings - Fork 46
/
huoshan.py
51 lines (42 loc) · 1.48 KB
/
huoshan.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
39
40
41
42
43
44
45
46
47
48
49
from appium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import time
# Appium 基本参数
platformName = 'Android'
platformVersion = '6'
deviceName = 'emulator-5554'
drvierserver = 'http://localhost:4725/wd/hub'
noReset = 'True'
timeout = 600
class Automation():
def __init__(self,appPackage,appActivity):
self.desired_caps = {
'platformName':platformName,
'platformVersion':platformVersion,
'deviceName':deviceName,
'appPackage':appPackage,
'appActivity':appActivity,
'noReset':noReset,
'newCommandTimeout':timeout
}
print('打开 appium 服务器...')
print('配置 appium ...')
self.driver = webdriver.Remote(drvierserver,self.desired_caps)
self.wait = WebDriverWait(self.driver, 15)
self.size = self.driver.get_window_size()
class Huoshan(Automation):
def __init__(self,APP_PACKAGE,APP_ACTIVITY):
super().__init__(APP_PACKAGE,APP_ACTIVITY)
def dailyClick(self):
# 点击红包
self.driver.find_element_by_id('com.ss.android.ugc.livelite:id/wl').click()
print('红包')
# 具体方法
def main(self):
# 每天签到
self.dailyClick()
eastnews_appPackage = 'com.ss.android.ugc.livelite'
eastnews_appActivity = 'com.ss.android.ugc.live.main.MainActivity'
if __name__ == '__main__':
eastnews = Huoshan(eastnews_appPackage,eastnews_appActivity)
eastnews.main()