【发布时间】:2021-05-17 21:41:14
【问题描述】:
我正在尝试使用 selenium 在 Python 中执行 JavaScript 代码。但我在下面得到了错误:
selenium.common.exceptions.JavascriptException: Message: javascript error: missing ) after argument list
这是我的代码:
def selenium_process():
driver = webdriver.Chrome(data[3])
x = 0
driver.get(data[0])
while x <= postCount:
driver.execute_script(f"window.open({data[0]});")
x = x + 1
if(x>postCount):
time.sleep(10000000)
注意:我从 GUI 获取数组元素作为输入,然后将它们附加到 data[] 数组中。
我该如何解决这个问题?
【问题讨论】:
标签: javascript python selenium