mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
完善设置功能,待测试
This commit is contained in:
parent
c68fd34c6b
commit
d1831de7a1
@ -31,12 +31,6 @@ class OptionsManager(object):
|
|||||||
self._chrome_options = None
|
self._chrome_options = None
|
||||||
self._session_options = None
|
self._session_options = None
|
||||||
|
|
||||||
# if 'tmp_path' not in self.paths or not self.get_value('paths', 'tmp_path'):
|
|
||||||
# tmp_path = str((Path(__file__).parent / 'tmp').absolute())
|
|
||||||
# Path(tmp_path).mkdir(parents=True, exist_ok=True)
|
|
||||||
# self.set_item('paths', 'tmp_path', tmp_path)
|
|
||||||
# self.save(self.ini_path)
|
|
||||||
|
|
||||||
def __text__(self) -> str:
|
def __text__(self) -> str:
|
||||||
"""打印ini文件内容"""
|
"""打印ini文件内容"""
|
||||||
return (f"paths:\n"
|
return (f"paths:\n"
|
||||||
@ -93,7 +87,7 @@ class OptionsManager(object):
|
|||||||
|
|
||||||
for j in items:
|
for j in items:
|
||||||
try:
|
try:
|
||||||
option[j[0]] = eval(self._conf.get(section, j[0]).replace('\\', '\\\\'))
|
option[j[0]] = eval(self._conf.get(section, j[0]))
|
||||||
except Exception:
|
except Exception:
|
||||||
option[j[0]] = self._conf.get(section, j[0])
|
option[j[0]] = self._conf.get(section, j[0])
|
||||||
|
|
||||||
@ -470,7 +464,9 @@ class DriverOptions(Options):
|
|||||||
self._driver_path = om.paths.get('chromedriver_path', None)
|
self._driver_path = om.paths.get('chromedriver_path', None)
|
||||||
self.set_window_rect = options_dict.get('set_window_rect', None)
|
self.set_window_rect = options_dict.get('set_window_rect', None)
|
||||||
self.page_load_strategy = om.paths.get('page_load_strategy', 'normal')
|
self.page_load_strategy = om.paths.get('page_load_strategy', 'normal')
|
||||||
self.timeouts = options_dict.get('timeouts', {'implicit': 10, 'pageLoad': 10, 'script': 10})
|
self.timeouts = options_dict.get('timeouts', {'implicit': 10, 'pageLoad': 30, 'script': 30})
|
||||||
|
self.timeouts['pageLoad'] *= 1000
|
||||||
|
self.timeouts['script'] *= 1000
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def driver_path(self) -> str:
|
def driver_path(self) -> str:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[paths]
|
[paths]
|
||||||
chromedriver_path =
|
chromedriver_path =
|
||||||
tmp_path =
|
tmp_path =
|
||||||
|
|
||||||
[chrome_options]
|
[chrome_options]
|
||||||
debugger_address = 127.0.0.1:9222
|
debugger_address = 127.0.0.1:9222
|
||||||
@ -8,15 +8,15 @@ binary_location =
|
|||||||
arguments = ['--no-sandbox', '--disable-gpu', '--ignore-certificate-errors', '--disable-infobars']
|
arguments = ['--no-sandbox', '--disable-gpu', '--ignore-certificate-errors', '--disable-infobars']
|
||||||
extensions = []
|
extensions = []
|
||||||
experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}, 'plugins.plugins_list': [{'enabled': False, 'name': 'Chrome PDF Viewer'}]}, 'useAutomationExtension': False, 'excludeSwitches': ['enable-automation']}
|
experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}, 'plugins.plugins_list': [{'enabled': False, 'name': 'Chrome PDF Viewer'}]}, 'useAutomationExtension': False, 'excludeSwitches': ['enable-automation']}
|
||||||
timeouts = {'implicit': 10, 'pageLoad': 50, 'script': 50}
|
timeouts = {'implicit': 10, 'pageLoad': 30, 'script': 30}
|
||||||
set_window_rect = None
|
set_window_rect = None
|
||||||
page_load_strategy = normal
|
page_load_strategy = normal
|
||||||
|
|
||||||
[session_options]
|
[session_options]
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
|
||||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
"Connection": "keep-alive",
|
"Connection": "keep-alive",
|
||||||
"Accept-Charset": "GB2312,utf-8;q=0.7,*;q=0.7"
|
"Accept-Charset": "GB2312,utf-8;q=0.7,*;q=0.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user