mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.0.5.0修复states.is_alive和wait.deleted()问题
This commit is contained in:
parent
b8aa656f45
commit
fb495a99be
@ -14,4 +14,4 @@ from ._configs.chromium_options import ChromiumOptions
|
||||
from ._configs.session_options import SessionOptions
|
||||
|
||||
__all__ = ['ChromiumPage', 'ChromiumOptions', 'SessionOptions', 'SessionPage', 'WebPage', '__version__']
|
||||
__version__ = '4.0.4.25'
|
||||
__version__ = '4.0.5.0'
|
||||
|
@ -42,9 +42,9 @@ class ElementStates(object):
|
||||
def is_alive(self):
|
||||
"""返回元素是否仍在DOM中"""
|
||||
try:
|
||||
self._ele.attrs
|
||||
return True
|
||||
except Exception:
|
||||
return self._ele.owner.run_cdp('DOM.describeNode',
|
||||
backendNodeId=self._ele._backend_id)['node']['nodeId'] != 0
|
||||
except ElementLostError:
|
||||
return False
|
||||
|
||||
@property
|
||||
@ -101,9 +101,9 @@ class ShadowRootStates(object):
|
||||
def is_alive(self):
|
||||
"""返回元素是否仍在DOM中"""
|
||||
try:
|
||||
self._ele.owner.run_cdp('DOM.describeNode', backendNodeId=self._ele._backend_id)
|
||||
return True
|
||||
except Exception:
|
||||
return self._ele.owner.run_cdp('DOM.describeNode',
|
||||
backendNodeId=self._ele._backend_id)['node']['nodeId'] != 0
|
||||
except ElementLostError:
|
||||
return False
|
||||
|
||||
|
||||
|
@ -495,7 +495,7 @@ class ElementWaiter(OriginWaiter):
|
||||
"""
|
||||
a = self._ele.states.__getattribute__(attr)
|
||||
if (a and mode) or (not a and not mode):
|
||||
return a
|
||||
return True if isinstance(a, bool) else a
|
||||
|
||||
if timeout is None:
|
||||
timeout = self._owner.timeout
|
||||
@ -503,7 +503,7 @@ class ElementWaiter(OriginWaiter):
|
||||
while perf_counter() < end_time:
|
||||
a = self._ele.states.__getattribute__(attr)
|
||||
if (a and mode) or (not a and not mode):
|
||||
return a
|
||||
return True if isinstance(a, bool) else a
|
||||
sleep(.05)
|
||||
|
||||
err_text = err_text or '等待元素状态改变失败(等待{}秒)。'
|
||||
|
Loading…
x
Reference in New Issue
Block a user