mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修复run_script()漏了args的问题
This commit is contained in:
parent
6162939809
commit
701b889447
@ -290,12 +290,13 @@ class DriverElement(DrissionElement):
|
||||
print(e)
|
||||
return False
|
||||
|
||||
def run_script(self, script: str) -> Any:
|
||||
"""执行js \n
|
||||
def run_script(self, script: str, *args) -> Any:
|
||||
"""执行js代码,传入自己为第一个参数 \n
|
||||
:param script: js文本
|
||||
:param args: 传入的参数
|
||||
:return: js执行结果
|
||||
"""
|
||||
return self.inner_ele.parent.execute_script(script, self.inner_ele)
|
||||
return self.inner_ele.parent.execute_script(script, self.inner_ele, *args)
|
||||
|
||||
def submit(self) -> None:
|
||||
"""提交表单"""
|
||||
|
@ -216,12 +216,13 @@ class DriverPage(object):
|
||||
"""
|
||||
return None
|
||||
|
||||
def run_script(self, script: str) -> Any:
|
||||
"""执行js \n
|
||||
def run_script(self, script: str, *args) -> Any:
|
||||
"""执行js代码 \n
|
||||
:param script: js文本
|
||||
:param args: 传入的参数
|
||||
:return: js执行结果
|
||||
"""
|
||||
return self.driver.execute_script(script)
|
||||
return self.driver.execute_script(script, *args)
|
||||
|
||||
@property
|
||||
def tabs_count(self) -> int:
|
||||
|
Loading…
x
Reference in New Issue
Block a user