在函数中添加“AI”的脚本

2024-09-30 22:20:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我选择了一个搜索按钮:

<input type="button" name="Submit" value="Submit" 
onclick="FnAddSearchParameters();" class="myButton rightButton buttonGroup">

使用chrome驱动程序,我一直试图点击按钮,但没有效果。常规的button.click()函数只突出显示按钮,但不完成onclick操作。你知道吗

使用execute_script("FnAddSearchParameters();")我得到错误语句

selenium.common.exceptions.WebDriverException: 
Message: unknown error: window.opener.FnAddAISearchParameters is not a function

关于为什么要将AI添加到函数调用中有什么想法吗?有办法吗?你知道吗


Tags: nameinputvaluetype驱动程序buttonchrome按钮
1条回答
网友
1楼 · 发布于 2024-09-30 22:20:26

实际上,您使用execute_script执行错误,您应该尝试以下操作:

button = driver.find_element_by_name("Submit")
driver.execute_script("arguments[0].click()", button)

相关问题 更多 >