I'm trying to crawl Booking.com site for reviews and hotel details. I managed to get the hotels details but when it comes to crawling reviews something weird happens !
I find the container that covers the reviews, but empty...
I made sure the elements I'm looking for are present by inspecting the page using Chrome DevTools
I even switched from using scrapy_splash to selenium in case the former may miss out any dynamic content, I also tried crawling it using BeautifulSoup and Xpath.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
DRIVER_PATH = './chromedriver'
chrome_options = Options()
# chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(options=chrome_options, executable_path=DRIVER_PATH)
driver.get("https://www.booking.com/hotel/tn/carlton-tunis.ar.html?label=gen173nr-1FCAEoggI46AdIM1gEaECIAQGYAQG4ARnIAQzYAQHoAQH4ARCIAgGoAgO4Ar351vgFwAIB0gIkNDUyNmFhZGQtODNkMy00Nzg1LWI3MzYtNWE4MzA5Y2RjY2Jk2AIG4AIB;dest_id=-731701;dest_type=city;dist=0;from_beach_non_key_ufi_sr=1;group_adults=2;group_children=0;hapos=1;hpos=1;no_rooms=1;room1=A%2CA;sb_price_type=total;sr_order=popularity;srepoch=1595260105;srpvid=1d9f6f249e3001d7;type=total;ucfs=1&#tab-reviews")
reviewsContainer = driver.find_element_by_xpath("//div[@id='review_list_page_container']/ul[@class='review_list']")
and as I said I get the error of not finding the specified element
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@id='review_list_page_container']/ul[@class='review_list']"}
(Session info: headless chrome=84.0.4147.89)
any help please ? thanks in advance!