在使用Selenium刮擦各种网站时,如何处理cookie弹出窗口?

发布于 2025-02-05 06:33:11 字数 148 浏览 2 评论 0原文

我正在尝试使用硒的砂纸刮擦〜10K不同的URL。在某些网站上,我所能刮的只是cookie弹出窗口。如何处理这些弹出窗口? Selenium驱动程序默认情况下可以接受所有cookie,以使cookie弹出窗口不会呈现吗?用选择器导航弹出窗口似乎是不可能的,因为它们在页面之间有所不同。

I am trying to scrape ~10k different urls, using Scrapy with Selenium. At some websites, all I can scrape is the cookie pop-up. How to handle those pop-ups in general? Can the selenium driver accept all cookies by default, so that the cookie pop-up would not render? Navigating the pop-ups with selectors seems impossible, as they differ from page to page.

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

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

发布评论

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

评论(1

月亮是我掰弯的 2025-02-12 06:33:14

使用不同架构的不同组件构建不同的网站。有些网站可以使用 vue.js 其他某些人可能会使用 ember.js

因此,在这些情况下不同网站上的按钮理想情况下是不同的。

因此,默认情况下所有网站上都接受所有cookie,因此没有任何通用解决方案。

Different websites are built using different components following different architecture. Some websites may use Vue.js where as some other may use Ember.js.

So in these cases the effective locator strategy to locate the Accept All button on different website is ideally bound to be different.

Hence there can be no generic solution to accept all cookies by default across all websites.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文