我在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

You can see in the picture that inspected element has wrong link. There is no such problem in a regular browser.
发布评论
评论(1)
这是网站的错误。因为我试图在4个浏览器中打开此URL:Safari,Chrome,Firefox,Selenium(Chrome)和元素29具有元素30.
但是,如果单击元素 29。皇家35牛排馆它将打开一个正确的。
这是因为元素29具有 onclick 事件,与正确的链接链接。
在浏览器的控制台中写入:
您将获得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:
You will get 37 elements. Inspect element 34 you will see next:
This is incorrect URL:
This is 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.