mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.1.0.2修复tab的post()报错;修复get_frame()不能输入数字
This commit is contained in:
parent
a8b89b51e2
commit
705fbb398c
@ -12,4 +12,4 @@ from ._pages.chromium_page import ChromiumPage
|
||||
from ._pages.session_page import SessionPage
|
||||
from ._pages.web_page import WebPage
|
||||
|
||||
__version__ = '4.1.0.1'
|
||||
__version__ = '4.1.0.2'
|
||||
|
@ -180,13 +180,14 @@ def make_session_ele(html_or_ele, loc=None, index=1, method=None):
|
||||
raise ValueError("定位符必须为str或长度为2的tuple。")
|
||||
|
||||
# ---------------根据传入对象类型获取页面对象和lxml元素对象---------------
|
||||
the_type = getattr(html_or_ele, '_type', None)
|
||||
# 直接传入html文本
|
||||
if isinstance(html_or_ele, str):
|
||||
page = None
|
||||
html_or_ele = fromstring(html_or_ele)
|
||||
|
||||
# SessionElement
|
||||
elif html_or_ele._type == 'SessionElement':
|
||||
elif the_type == 'SessionElement':
|
||||
page = html_or_ele.owner
|
||||
|
||||
loc_str = loc[1]
|
||||
@ -207,7 +208,7 @@ def make_session_ele(html_or_ele, loc=None, index=1, method=None):
|
||||
|
||||
loc = loc[0], loc_str
|
||||
|
||||
elif html_or_ele._type == 'ChromiumElement':
|
||||
elif the_type == 'ChromiumElement':
|
||||
loc_str = loc[1]
|
||||
if loc[0] == 'xpath' and loc[1].lstrip().startswith('/'):
|
||||
loc_str = f'.{loc[1]}'
|
||||
@ -230,7 +231,7 @@ def make_session_ele(html_or_ele, loc=None, index=1, method=None):
|
||||
html_or_ele = fromstring(html)
|
||||
html_or_ele = html_or_ele.xpath(xpath)[0]
|
||||
|
||||
elif html_or_ele._type == 'ChromiumFrame':
|
||||
elif the_type == 'ChromiumFrame':
|
||||
page = html_or_ele
|
||||
html_or_ele = fromstring(html_or_ele.inner_html)
|
||||
|
||||
|
@ -309,6 +309,12 @@ def get_frame(owner, loc_ind_ele, timeout=None):
|
||||
raise TypeError('该定位符不是指向frame元素。')
|
||||
r = ele
|
||||
|
||||
elif isinstance(loc_ind_ele, int):
|
||||
ele = owner._ele('@|tag():iframe@|tag():frame', timeout=timeout, index=loc_ind_ele)
|
||||
if ele and ele._type != 'ChromiumFrame':
|
||||
raise TypeError('该定位符不是指向frame元素。')
|
||||
r = ele
|
||||
|
||||
elif getattr(loc_ind_ele, '_type', None) == 'ChromiumFrame':
|
||||
r = loc_ind_ele
|
||||
|
||||
|
@ -100,6 +100,8 @@ class MixTab(SessionPage, ChromiumTab, BasePage):
|
||||
self.cookies_to_session()
|
||||
if timeout is None:
|
||||
kwargs['timeout'] = self.timeouts.page_load
|
||||
if self._session is None:
|
||||
self._create_session()
|
||||
super().post(url, show_errmsg, retry, interval, **kwargs)
|
||||
return self.response
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user