fix: added 'short' function

This commit is contained in:
2026-06-25 12:02:45 +08:00
parent f2628d0a2d
commit 534778c562
2 changed files with 6 additions and 1 deletions
+2
View File
@@ -3,6 +3,7 @@ from common.utils.selenium import (
sleep, sleep,
locate, locate,
click, click,
short,
setup, setup,
) )
@@ -11,5 +12,6 @@ __all__ = [
'sleep', 'sleep',
'locate', 'locate',
'click', 'click',
'short',
'setup', 'setup',
] ]
+4 -1
View File
@@ -73,8 +73,11 @@ def click(selector: str|WebElement, wait=True, condition=False):
try: driver.execute_script("arguments[0].removeEventListener('click', __%s__);" % identity, element) try: driver.execute_script("arguments[0].removeEventListener('click', __%s__);" % identity, element)
except: pass except: pass
def short():
return ''.join(random.choices(string.digits + string.ascii_uppercase + string.ascii_lowercase, k=8))
def setup(a: WebDriver, b: dict): def setup(a: WebDriver, b: dict):
global identity, driver global identity, driver
identity = ''.join(random.choices(string.ascii_uppercase + string.digits, k=8)) identity = short()
driver = a driver = a
parameters.update(b) parameters.update(b)