mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
ChromiumFrame补充style();DownloadKit指定2.0.7或以上
This commit is contained in:
parent
2db39d3176
commit
0d9951f516
@ -33,7 +33,7 @@ from .._units.scroller import PageScroller
|
|||||||
from .._units.setter import ChromiumBaseSetter
|
from .._units.setter import ChromiumBaseSetter
|
||||||
from .._units.states import PageStates
|
from .._units.states import PageStates
|
||||||
from .._units.waiter import BaseWaiter
|
from .._units.waiter import BaseWaiter
|
||||||
from ..errors import ContextLostError, CDPError, PageDisconnectedError, ElementLostError
|
from ..errors import ContextLostError, CDPError, PageDisconnectedError, ElementLostError, JavaScriptError
|
||||||
|
|
||||||
__ERROR__ = 'error'
|
__ERROR__ = 'error'
|
||||||
|
|
||||||
@ -600,7 +600,10 @@ class ChromiumBase(BasePage):
|
|||||||
else:
|
else:
|
||||||
raise TypeError('html_or_info参数必须是html文本或tuple,tuple格式为(tag, {name: value})。')
|
raise TypeError('html_or_info参数必须是html文本或tuple,tuple格式为(tag, {name: value})。')
|
||||||
|
|
||||||
|
try:
|
||||||
ele = self._run_js(js, *args)
|
ele = self._run_js(js, *args)
|
||||||
|
except JavaScriptError:
|
||||||
|
raise RuntimeError('此网页DOM不允许修改。')
|
||||||
return ele
|
return ele
|
||||||
|
|
||||||
def get_frame(self, loc_ind_ele, timeout=None):
|
def get_frame(self, loc_ind_ele, timeout=None):
|
||||||
|
@ -333,6 +333,9 @@ class ChromiumFrame(ChromiumBase):
|
|||||||
def remove_attr(self, name):
|
def remove_attr(self, name):
|
||||||
self.frame_ele.remove_attr(name)
|
self.frame_ele.remove_attr(name)
|
||||||
|
|
||||||
|
def style(self, style, pseudo_ele=''):
|
||||||
|
return self.frame_ele.style(style=style, pseudo_ele=pseudo_ele)
|
||||||
|
|
||||||
def run_js(self, script, *args, as_expr=False, timeout=None):
|
def run_js(self, script, *args, as_expr=False, timeout=None):
|
||||||
return self._run_js(script, *args, as_expr=as_expr, timeout=timeout)
|
return self._run_js(script, *args, as_expr=as_expr, timeout=timeout)
|
||||||
|
|
||||||
|
@ -240,6 +240,14 @@ class ChromiumFrame(ChromiumBase):
|
|||||||
"""
|
"""
|
||||||
...
|
...
|
||||||
|
|
||||||
|
def style(self, style: str, pseudo_ele: str = '') -> str:
|
||||||
|
"""返回frame元素样式属性值,可获取伪元素属性值
|
||||||
|
:param style: 样式属性名称
|
||||||
|
:param pseudo_ele: 伪元素名称(如有)
|
||||||
|
:return: 样式属性的值
|
||||||
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def run_js(self,
|
def run_js(self,
|
||||||
script: str,
|
script: str,
|
||||||
*args,
|
*args,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
requests
|
requests
|
||||||
lxml
|
lxml
|
||||||
cssselect
|
cssselect
|
||||||
DownloadKit>=2.0.5
|
DownloadKit>=2.0.7
|
||||||
websocket-client
|
websocket-client
|
||||||
click
|
click
|
||||||
tldextract>=3.4.4
|
tldextract>=3.4.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user