为什么硒打开的页面与常规浏览器不同

发布于 2025-02-06 15:46:22 字数 428 浏览 2 评论 0 原文

我在TripAdvisor上练习数据刮擦,我不明白为什么列表中的倒数第二项(项目29)具有其中最后一项的链接。链接列表: 您可以在图片中看到检查元素的链接错误。常规浏览器中没有这样的问题。

I practice data scraping on tripadvisor and I can't understand why the penultimate item on the list (item 29) has a link from the last item in it. Link to the list: https://www.tripadvisor.com/Restaurants-g60763-New_York_City_New_York.html
enter image description here
You can see in the picture that inspected element has wrong link. There is no such problem in a regular browser.

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

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

发布评论

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

评论(1

杯别 2025-02-13 15:46:22

这是网站的错误。因为我试图在4个浏览器中打开此URL:Safari,Chrome,Firefox,Selenium(Chrome)和元素29具有元素30.
但是,如果单击元素 29。皇家35牛排馆它将打开一个正确的
这是因为元素29具有 onclick 事件,与正确的链接链接

在浏览器的控制台中写入:

document.getelementsbyclassname("bHGqj Cj b")

您将获得37个元素。检查元素34您将看到下一步:

这是不正确的URL:

“

这是正确的url:

​某些属性 __ ReactProps 具有正确的数据。在您单击元素29之前我说的话,它将您发送到正确的链接。
它正常工作,这就是为什么没有人意识到有错误的原因。

It is a bug of the website. Because i tried to open this URL in 4 browsers: Safari, Chrome, Firefox, Selenium(Chrome) and the element 29 has href of element 30.
But if you click element 29. Royal 35 Steakhouse it will open a correct link.
It is because the element 29 has onclick event that is linked to the correct link.

Write in console of your browser:

document.getelementsbyclassname("bHGqj Cj b")

You will get 37 elements. Inspect element 34 you will see next:

This is incorrect URL:

Bad URL

This is correct URL:

correct URL

As you can see there is some property __reactProps that has correct data. How i said before when you click element 29 it send you to the correct link.
It works correctly and that is why nobody realizes that there is an error.

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