我正在尝试使用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[]
数组中
我怎样才能解决这个问题
当数据是字符串而不是变量(或int或float-但无论如何,这不是
window.open
的有效参数)时,在数据周围添加引号:相关问题 更多 >
编程相关推荐