This is with reference to this question. Trying to scrape this site
Expected output is :
Name of the Hotel
First arrangement option : its prize
Code I have tried so far:
driver.maximize_window()
driver.implicitly_wait(10)
driver.get("https://tn.tunisiebooking.com/")
#code to choose the option "Sousse" ,date- 06/08/21, and click on "Rechercher".
hotels = driver.find_elements_by_xpath("//div[starts-with(@id,'produit_affair')]")
for hotel in hotels:
name = hotel.find_element_by_tag_name("h3").text
argmts = hotel.find_element_by_class_name("angle_active").text
prize = hotel.find_element_by_xpath("//div[starts-with(@id,'prixtotal_')]").text
print(name)
print(argmts + ':' + prize)
driver.quit()
The output I get:
Petit dejeuner:60
Tui Blue Scheherazade
Demi pension:60
Golf Residence GAS
Petit dejeuner:60
Sindbad Center GAS
Logement seul:60 ...
Applied scrolling
effect and time.sleep
. But the prize
remains same, its doesn't get the prize of the respective Hotel. Not sure where its going wrong.