-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
80 lines (62 loc) · 1.96 KB
/
Copy pathtest.py
File metadata and controls
80 lines (62 loc) · 1.96 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
73
74
75
76
77
78
79
80
#!/usr/bin/python
# coding=utf-8
import sys
import zipfile
import shutil
import os
import os.path
import time
import datetime
import json
#include common.py
#
o_path = os.getcwd() # 返回当前工作目录
print(o_path)
# sys.path.append(o_path) # 添加自己指定的搜索路径
# 当前工作目录 Common/PythonCreator/ProjectConfig/Script
sys.path.append('../../')
# sys.path.append('./')
dir = os.path.abspath(__file__)
print(dir)
dir = os.path.dirname(dir)
print(dir)
# sys.path.append("..") #把上级目录加入到变量中
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import ActionChains
from selenium import webdriver
class test():
driver: None
filepathSmail=""
#构造函数
def __init__(self):
name =""
def Init(self):
# 创建chrome浏览器驱动,无头模式(超爽)
chrome_options = Options()
# chrome_options.add_argument('--headless')
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')
self.driver = webdriver.Chrome(chrome_options=chrome_options)
# 全屏
self.driver.maximize_window()
# 具体大小
# driver.set_window_size(width, height)
# self.GoHome()
# self.Login()
# time.sleep(2)
# GoAppgallery(driver)
# # 快照显示已经成功登录
# print(driver.save_screenshot('jietu.png'))
# driver.quit()
# 主函数的实现
if __name__ == "__main__":
# 入口参数:http://blog.csdn.net/intel80586/article/details/8545572
p = test()
p.Init()
p.GoApp(isHD)
print("test sucess arg=",arg2)