优化set_attr()

This commit is contained in:
g1879 2021-02-08 15:11:22 +08:00
parent 066caf2f23
commit 30cd456cd1

View File

@ -460,7 +460,7 @@ class DriverElement(DrissionElement):
:return: 是否设置成功
"""
try:
self.run_script(f"arguments[0].{attr} = '{value}';")
self.run_script(f"arguments[0].setAttribute(arguments[1], arguments[2]);", attr, value)
return True
except:
return False