mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.0.5.2修改视觉相对定位参数
This commit is contained in:
parent
fb495a99be
commit
c26a71e80c
@ -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.5.0'
|
||||
__version__ = '4.0.5.2'
|
||||
|
@ -366,37 +366,37 @@ class ChromiumElement(DrissionElement):
|
||||
except CDPError:
|
||||
return NoneElement(page=self.owner, method='offset()', args={'offset_x': offset_x, 'offset_y': offset_y})
|
||||
|
||||
def east(self, locator=None, index=1):
|
||||
def east(self, loc_or_pixel=None, index=1):
|
||||
"""获取元素右边某个指定元素
|
||||
:param locator: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param loc_or_pixel: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param index: 第几个,从1开始
|
||||
:return: 获取到的元素对象
|
||||
"""
|
||||
return self._get_relative_eles(mode='east', locator=locator, index=index)
|
||||
return self._get_relative_eles(mode='east', locator=loc_or_pixel, index=index)
|
||||
|
||||
def south(self, locator=None, index=1):
|
||||
def south(self, loc_or_pixel=None, index=1):
|
||||
"""获取元素下方某个指定元素
|
||||
:param locator: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param loc_or_pixel: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param index: 第几个,从1开始
|
||||
:return: 获取到的元素对象
|
||||
"""
|
||||
return self._get_relative_eles(mode='south', locator=locator, index=index)
|
||||
return self._get_relative_eles(mode='south', locator=loc_or_pixel, index=index)
|
||||
|
||||
def west(self, locator=None, index=1):
|
||||
def west(self, loc_or_pixel=None, index=1):
|
||||
"""获取元素左边某个指定元素
|
||||
:param locator: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param loc_or_pixel: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param index: 第几个,从1开始
|
||||
:return: 获取到的元素对象
|
||||
"""
|
||||
return self._get_relative_eles(mode='west', locator=locator, index=index)
|
||||
return self._get_relative_eles(mode='west', locator=loc_or_pixel, index=index)
|
||||
|
||||
def north(self, locator=None, index=1):
|
||||
def north(self, loc_or_pixel=None, index=1):
|
||||
"""获取元素上方某个指定元素
|
||||
:param locator: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param loc_or_pixel: 定位符,只支持str,且不支持xpath和css方式,传入int按像素距离获取
|
||||
:param index: 第几个,从1开始
|
||||
:return: 获取到的元素对象
|
||||
"""
|
||||
return self._get_relative_eles(mode='north', locator=locator, index=index)
|
||||
return self._get_relative_eles(mode='north', locator=loc_or_pixel, index=index)
|
||||
|
||||
def _get_relative_eles(self, mode='north', locator=None, index=1):
|
||||
"""获取元素下方某个指定元素
|
||||
@ -445,7 +445,7 @@ class ChromiumElement(DrissionElement):
|
||||
return NoneElement(page=self.owner, method=f'{mode}()', args={'locator': locator})
|
||||
|
||||
num = 0
|
||||
value = -3 if minus else 3
|
||||
value = -8 if minus else 8
|
||||
size = self.owner.rect.size
|
||||
max_len = size[0] if mode == 'east' else size[1]
|
||||
loc_data = locator_to_tuple(locator) if locator else None
|
||||
|
@ -161,15 +161,15 @@ class ChromiumElement(DrissionElement):
|
||||
|
||||
def over(self, timeout: float = None) -> ChromiumElement: ...
|
||||
|
||||
def south(self, locator: str = None, index: int = 1) -> ChromiumElement: ...
|
||||
def south(self, loc_or_pixel: Union[str, int, None] = None, index: int = 1) -> ChromiumElement: ...
|
||||
|
||||
def north(self, locator: str = None, index: int = 1) -> ChromiumElement: ...
|
||||
def north(self, loc_or_pixel: Union[str, int, None] = None, index: int = 1) -> ChromiumElement: ...
|
||||
|
||||
def west(self, locator: str = None, index: int = 1) -> ChromiumElement: ...
|
||||
def west(self, loc_or_pixel: Union[str, int, None] = None, index: int = 1) -> ChromiumElement: ...
|
||||
|
||||
def east(self, locator: str = None, index: int = 1) -> ChromiumElement: ...
|
||||
def east(self, loc_or_pixel: Union[str, int, None] = None, index: int = 1) -> ChromiumElement: ...
|
||||
|
||||
def offset(self, offset_x, offset_y) -> ChromiumElement: ...
|
||||
def offset(self, offset_x: int, offset_y: int) -> ChromiumElement: ...
|
||||
|
||||
def _get_relative_eles(self,
|
||||
mode: str = 'north',
|
||||
|
@ -7,9 +7,10 @@
|
||||
"""
|
||||
from ._elements.session_element import make_session_ele
|
||||
from ._functions.by import By
|
||||
from ._functions.elements import get_eles
|
||||
from ._functions.keys import Keys
|
||||
from ._functions.settings import Settings
|
||||
from ._functions.tools import wait_until, configs_to_here, get_eles
|
||||
from ._functions.tools import wait_until, configs_to_here
|
||||
from ._functions.web import get_blob, tree
|
||||
from ._pages.chromium_page import ChromiumPage
|
||||
from ._units.actions import Actions
|
||||
|
Loading…
x
Reference in New Issue
Block a user