Scraping a dynamic website using Python and Selenium.

Introduction

Setting system up for the project

Structure of the project directory.
Importing libraries needed.

Starting with the process:

You can see the block at the bottom asking you to Agree on terms.
Listings page with the basic information on rooms.
This you will find on the details page.
#clicking the accepting button 
cookies_btn = driver.find_element('xpath', '//*[@id="didomi-host"]/div/div/div/div//div[2]/button[2]')
cookies_btn.click()
# we used xpath to access the element and once we get the object made for the element we can click simply by adding click() method.
# inputing the locations from the given list 
input_field.send_keys(loc)
ActionChains(driver).send_keys(Keys.DOWN).send_keys(Keys.ENTER).perform()
# we replicated the interaction we make to input and submit the query in the input bar using action chains
Extracting information.

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store