Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error: "NoSuchElementException" for "things to do" scraper #14

Open
Ema8899 opened this issue Jan 5, 2022 · 6 comments
Open

Comments

@Ema8899
Copy link

Ema8899 commented Jan 5, 2022

Hello @giuseppegambino!

I was trying your code (thanks a lot for publishing it), and while the code to scrape restaurants' reviews works, the code to scrape reviews for "things to do" does not work. I get this message when I run it:

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":".//div[contains(@data-test-target, 'expand-review')]"}

Would it be possible for you to fix it? It would be extremely helpful. Thanks a lot and happy 2022!

@giuseppegambino
Copy link
Owner

giuseppegambino commented Jan 5, 2022

Hello @Ema8899

I took a look at the script's default site, which is this: https://www.tripadvisor.com/Hotel_Review-g60763-d1218720-Reviews-The_Standard_High_Line-New_York_City_New_York.html and the element actually exists.

Can you please link the website with which you gave the error?
Because before doing some tests / debugging I would like to understand if by chance the site in question has only short reviews and therefore does not have the button to show them complete.

Happy 2022 to you too :)

@Ema8899
Copy link
Author

Ema8899 commented Jan 5, 2022

@giuseppegambino: thanks for your prompt reply!

Here is the link of the attraction:
https://www.tripadvisor.com/Attraction_Review-g187791-d197714-Reviews-Pantheon-Rome_Lazio.html

Just to be sure, I have tried the code just now and it keeps giving me the error I mentioned above.

Thanks again for your help!

@giuseppegambino
Copy link
Owner

giuseppegambino commented Jan 5, 2022

They changed again the webpages :((

I am noticing that now there is not only the difference between restaurants and everything else (which I had called things_to_do), but there is the "hotels" section, so now there are 3 (or at least those counted by me) site structures on tripadvisor: restaurants, hotels and tourist attractions.

Fortunately, but not for you, the hotel pages retain the structure of the old "things to do", instead the tourist attractions have different html / css fields .. so I have to work on it a bit ..

As soon as I have some free time, I immediately get to work! Thanks for the update @Ema8899

@Ema8899
Copy link
Author

Ema8899 commented Jan 5, 2022

Thank you @giuseppegambino

Have a good day!

@glaupie
Copy link

glaupie commented Apr 12, 2022

Hi @giuseppegambino have you perhaps had a chance to update this to cater for Hotels?

@spudmc10
Copy link

Hi @giuseppegambino I'm really excited to work with this script. I don't know if you've had time to look at the new CSS/HTML, but was wondering if there had been any updates to the 'Attractions' script. When I run it I get the following error (similar but distinct from the person above):

Message: no such element: Unable to locate element: {"method":"xpath","selector":".//div[@class='_2fxQ4TOx']"}

I was just wondering since this is for the dates element if there might be a way for me to find the xpath on the Chrome site itself by inspecting it--I tried but no luck yet.
Anyway, appreciate all the hard work you've done on this, thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants