Python 单击selenium中的图像

Python 单击selenium中的图像,python,Python,我在以下HTML中使用Chromedriver with Selenium单击图像时遇到问题: <div class="modal_buttons"> <input type="image" name="GoButton" id="GoButton" tabindex=14 title="Continue" alt="Continue" onfocus="SetLastFocus(this.id)" src="https://t4.ftcdn.net/jpg/00/81/83/

我在以下HTML中使用Chromedriver with Selenium单击图像时遇到问题:

<div class="modal_buttons">
<input type="image" name="GoButton" id="GoButton" tabindex=14 title="Continue" alt="Continue" onfocus="SetLastFocus(this.id)" src="https://t4.ftcdn.net/jpg/00/81/83/05/240_F_81830511_aJbF2vH9yufF0UAUFQ83JDnbp0jE5mNV.jpg"
Selenium每次都失败,并且给出了无法找到按钮的错误列表。有没有办法解决这个问题

谢谢

试试:

driver.find_element_by_xpath("//input[@id='GoButton'][@name='GoButton']").click()


您在Selenium中使用隐式或显式等待页面加载吗?我相信隐式等待可以显示完整的Python代码文件吗?我得到了与以前相同的错误。。。它仍然找不到元素它仍然不工作。。。。每次我遇到与“selenium.common.exceptions.NoSuchElementException:Message:没有这样的元素:无法定位元素”相同的错误时,错误就说明了一切。元素位于
iFrame
中,您必须首先切换到帧,然后搜索元素,或者必须引入
显式等待
,才能单击图像。谢谢
driver.find_element_by_xpath("//input[@id='GoButton'][@name='GoButton']").click()
driver.find_element_by_xpath("//input[@id='GoButton'][@title='Continue']").click()
driver.find_element_by_xpath("//input[@name='GoButton'][@title='Continue']").click()
driver.find_element_by_xpath("//input[contains(@src,'240_F_81830511_aJbF2vH9yufF0UAUFQ83JDnbp0jE5mNV.jpg')]")