4.1.0.0b10微调

This commit is contained in:
g1879 2024-07-19 17:35:55 +08:00
parent 71ac85d3bf
commit 2dd44d1982
3 changed files with 11 additions and 9 deletions

View File

@ -14,4 +14,4 @@ from ._pages.chromium_page import ChromiumPage
from ._pages.mix_page import MixPage from ._pages.mix_page import MixPage
from ._pages.mix_page import MixPage as WebPage from ._pages.mix_page import MixPage as WebPage
__version__ = '4.1.0.0b9' __version__ = '4.1.0.0b10'

View File

@ -15,7 +15,7 @@ from websocket import (WebSocketTimeoutException, WebSocketConnectionClosedExcep
WebSocketException, WebSocketBadStatusException) WebSocketException, WebSocketBadStatusException)
from .._functions.settings import Settings from .._functions.settings import Settings
from ..errors import PageDisconnectedError from ..errors import PageDisconnectedError, BrowserConnectError
class Driver(object): class Driver(object):
@ -206,6 +206,8 @@ class Driver(object):
raise RuntimeError('请升级websocket-client库。') raise RuntimeError('请升级websocket-client库。')
else: else:
return return
except ConnectionRefusedError:
raise BrowserConnectError('浏览器未开启或已关闭。')
self._recv_th.start() self._recv_th.start()
self._handle_event_th.start() self._handle_event_th.start()
return True return True

View File

@ -214,14 +214,14 @@ class ChromiumOptions(object):
:param value: 设置项名有值的设置项传入设置名称即可 :param value: 设置项名有值的设置项传入设置名称即可
:return: 当前对象 :return: 当前对象
""" """
del_list = [] elements_to_delete = [arg for arg in self._arguments if arg == value or arg.startswith(f'{value}=')]
if not elements_to_delete:
return self
for argument in self._arguments: if len(elements_to_delete) == 1:
if argument == value or argument.startswith(f'{value}='): self._arguments.remove(elements_to_delete[0])
del_list.append(argument) else:
self._arguments = [arg for arg in self._arguments if arg not in elements_to_delete]
for del_arg in del_list:
self._arguments.remove(del_arg)
return self return self