我如何使用硒接受这些饼干?

发布于 2025-02-05 20:48:24 字数 286 浏览 1 评论 0原文

我正在尝试刮擦此网站 https://www.parkers.co.uk 但是对于某些原因我似乎无法超越cookie弹出,我尝试了此代码

cookies = driver.find_element_by_xpath('//*[@ID =“ notfect”]/div [5]/button [2]') cookies.click(),

但似乎不起作用,我该怎么办?

I'm trying to scrape this website https://www.parkers.co.uk but for some reason I cannot seem to get past the cookies pop up, I've tried with this code

cookies = driver.find_element_by_xpath('//*[@id="notice"]/div[5]/button[2]')
cookies.click()

but it doesn't seem to be working, what can I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俏︾媚 2025-02-12 20:48:24

尝试以下操作:

 iframe = driver.find_element_by_xpath("//iframe[@title='SP Consent Message']")
 driver.switch_to.frame(iframe)
 driver.find_element_by_xpath("//button[@title='Accept All']").click()

Try this:

 iframe = driver.find_element_by_xpath("//iframe[@title='SP Consent Message']")
 driver.switch_to.frame(iframe)
 driver.find_element_by_xpath("//button[@title='Accept All']").click()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文