mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微调
This commit is contained in:
parent
af6a759b4a
commit
072aad6eaf
@ -209,10 +209,10 @@ def test_connect(ip, port, timeout=30):
|
||||
sleep(.2)
|
||||
|
||||
raise BrowserConnectError(f'\n{ip}:{port}浏览器无法链接。\n请确认:\n1、该端口为浏览器\n'
|
||||
f'2、已添加--remote-debugging-port={port}启动项\n'
|
||||
f'2、已添加\'--remote-debugging-port={port}\'启动项\n'
|
||||
f'3、用户文件夹没有和已打开的浏览器冲突\n'
|
||||
f'4、如为无界面系统,请添加--headless=new参数\n'
|
||||
f'5、如果是Linux系统,可能还要添加--no-sandbox启动参数\n'
|
||||
f'4、如为无界面系统,请添加\'--headless=new\'参数\n'
|
||||
f'5、如果是Linux系统,可能还要添加\'--no-sandbox\'启动参数\n'
|
||||
f'可使用ChromiumOptions设置端口和用户文件夹路径。')
|
||||
|
||||
|
||||
|
@ -62,10 +62,13 @@ class ChromiumPage(ChromiumBase):
|
||||
def _run_browser(self):
|
||||
"""连接浏览器"""
|
||||
is_exist = connect_browser(self._chromium_options)
|
||||
ws = get(f'http://{self._chromium_options.debugger_address}/json/version',
|
||||
headers={'Connection': 'close'})
|
||||
if not ws:
|
||||
raise BrowserConnectError('\n浏览器连接失败,请检查是否启用全局代理。如有,须开放127.0.0.1地址。')
|
||||
try:
|
||||
ws = get(f'http://{self._chromium_options.debugger_address}/json/version', headers={'Connection': 'close'})
|
||||
if not ws:
|
||||
raise BrowserConnectError('\n浏览器连接失败,请检查是否启用全局代理。如是,须设置不代理127.0.0.1地址。')
|
||||
except :
|
||||
raise BrowserConnectError('\n浏览器连接失败,请检查是否启用全局代理。如是,须设置不代理127.0.0.1地址。')
|
||||
|
||||
ws = ws.json()['webSocketDebuggerUrl'].split('/')[-1]
|
||||
self._browser = Browser(self._chromium_options.debugger_address, ws, self)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user