优化Scroll;download()默认显示信息

This commit is contained in:
g1879 2022-01-16 21:45:14 +08:00
parent afaed79e5b
commit 080c501c13
3 changed files with 8 additions and 18 deletions

View File

@ -1174,37 +1174,27 @@ class Scroll(object):
:param pixel: 滚动的像素 :param pixel: 滚动的像素
:return: None :return: None
""" """
if pixel < 0: pixel = -pixel
self.down(-pixel) self.driver.run_script(f'{self.t1}.scrollBy(0,{pixel});')
else:
self.driver.run_script(f'{self.t1}.scrollBy(0,-{pixel});')
def down(self, pixel: int = 300) -> None: def down(self, pixel: int = 300) -> None:
"""向下滚动若干像素,水平位置不变 \n """向下滚动若干像素,水平位置不变 \n
:param pixel: 滚动的像素 :param pixel: 滚动的像素
:return: None :return: None
""" """
if pixel < 0: self.driver.run_script(f'{self.t1}.scrollBy(0,{pixel});')
self.up(-pixel)
else:
self.driver.run_script(f'{self.t1}.scrollBy(0,{pixel});')
def left(self, pixel: int = 300) -> None: def left(self, pixel: int = 300) -> None:
"""向左滚动若干像素,水平位置不变 \n """向左滚动若干像素,水平位置不变 \n
:param pixel: 滚动的像素 :param pixel: 滚动的像素
:return: None :return: None
""" """
if pixel < 0: pixel = -pixel
self.right(-pixel) self.driver.run_script(f'{self.t1}.scrollBy({pixel},0);')
else:
self.driver.run_script(f'{self.t1}.scrollBy(-{pixel},0);')
def right(self, pixel: int = 300) -> None: def right(self, pixel: int = 300) -> None:
"""向右滚动若干像素,水平位置不变 \n """向右滚动若干像素,水平位置不变 \n
:param pixel: 滚动的像素 :param pixel: 滚动的像素
:return: None :return: None
""" """
if pixel < 0: self.driver.run_script(f'{self.t1}.scrollBy({pixel},0);')
self.left(-pixel)
else:
self.driver.run_script(f'{self.t1}.scrollBy({pixel},0);')

View File

@ -380,7 +380,7 @@ class MixPage(SessionPage, DriverPage, BasePage):
rename: str = None, rename: str = None,
file_exists: str = 'rename', file_exists: str = 'rename',
post_data: Union[str, dict] = None, post_data: Union[str, dict] = None,
show_msg: bool = False, show_msg: bool = True,
show_errmsg: bool = False, show_errmsg: bool = False,
retry: int = None, retry: int = None,
interval: float = None, interval: float = None,

View File

@ -261,7 +261,7 @@ class SessionPage(BasePage):
file_exists: str = 'rename', file_exists: str = 'rename',
post_data: Union[str, dict] = None, post_data: Union[str, dict] = None,
show_msg: bool = False, show_msg: bool = False,
show_errmsg: bool = False, show_errmsg: bool = True,
retry: int = None, retry: int = None,
interval: float = None, interval: float = None,
**kwargs) -> tuple: **kwargs) -> tuple: