单击图像以使用selenium python访问网站上的另一个页面

单击图像以使用selenium python访问网站上的另一个页面,python,selenium-webdriver,selenium-chromedriver,Python,Selenium Webdriver,Selenium Chromedriver,我正在尝试自动单击网站上的图像下面是网站上的代码。 <div class="home-page-button"> <div> <a name="ContinueToBookingSystem" formaction="/Home/ContinueToBookingSystem"> <img src="/public/img/icons/home-plane.png" alt="Continue to booking system"/> </a

我正在尝试自动单击网站上的图像下面是网站上的代码。

<div class="home-page-button">
<div>
<a name="ContinueToBookingSystem" formaction="/Home/ContinueToBookingSystem">
<img src="/public/img/icons/home-plane.png" alt="Continue to booking system"/>
</a>
</div>
<div>Continue to booking system</div>
这就是我所尝试的

ctbs = driver.find_elements_by_xpath("//div[@class='home-page-button]//a[@alt='Continue to booking system']")
ctbs.click()
感谢您的帮助


提前谢谢

您正在调用驱动程序。通过xpath查找\u元素s\u

尝试
驱动程序。通过不带s的xpath查找\u元素。您还缺少
@class='home-page-button'
的一个封闭单引号

ctbs = driver.find_element_by_xpath("//div[@class='home-page-button']//img[@alt='Continue to booking system']")
ctbs.click()

更新:
xpath
中的“a”标记更改为“img”

谢谢,我已经根据您的答案更新了代码。不幸的是,我仍然得到一个错误。消息:没有这样的元素:无法找到元素:{“方法”:“xpath”,“选择器”:”//div[@class='home-page-button']//a[@alt='Continue to booking system']]“}您可以共享网站URL吗?很遗憾,这不需要登录。如果有帮助的话,我可以给你发送更多的代码。我又看了看你的html。请参阅更新答案。我感谢您的帮助!但是仍然收到一个错误:(消息:没有这样的元素:无法找到元素:{“方法”:“xpath”,“选择器”:”//div[@class='home-page-button']//img[@alt='Continue to booking system']”
ctbs = driver.find_element_by_xpath("//div[@class='home-page-button']//img[@alt='Continue to booking system']")
ctbs.click()