Im learning Scrapy by scraping some tripadvisor attraction. (for example this page: https://www.tripadvisor.com/Attractions-g187791-Activities-Rome_Lazio.html). One of the problems I'm facing is that if a review is longer than a certain length it will display a "more" button, which then with javascript expands the text. I'm not able to post the request to expand the text on these reviews.
folloing the advice given here: Click a Button in Scrapy
I've fetched the post request: Request URL:https://www.tripadvisor.com/OverlayWidgetAjax?Mode=EXPANDED_HOTEL_REVIEWS_RESP&metaReferer=
Request method:POST
In scrapy shell I've tried the following:
from scrapy.http.request import Request
fetch("https://stackoverflow.com/questions/6682503/click-a-button-in-scrapy")
Request(url="https://www.tripadvisor.com/OverlayWidgetAjax?Mode=EXPANDED_HOTEL_REVIEWS_RESP&metaReferer=",method="POST")
and then compared the results of said reviews by calling:
response.css("p.partial_entry").getall()
In difference to the stack example this doesn't have a form to send, but only a simple request which is to expand the texts. 1 click on a "more" button expands all those cases on the page. So I would expect this method to expand all texts, but it doesnt expand anything, or change anything on the page.
My main problem is that I'm having a hard time testing since I'm working through the scrapy shell or bash.