I'm trying to scrape data from a window which appear when hovering over a marker in map view and scrape the "Days Available" value from the window.
image of text which I am trying to scrape
I'm struggling to hover over all all the purple markers one by one in map view using python, webdriver and BeautifulSoup. I managed to write the below code but mapMarkers variable is always blank.
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.airdna.co/vacation-rental-data/app/us/california/santa-monica/overview")
input("Press Enter to continue...") # wait until page loads and tutorial is closed
mapMarkers = driver.find_elements_by_class_name("Page__RightColumn-sc-291lxm-3") # get a list of marker element
target_list = []
for i in range(len(mapMarkers)):
mapMarkers[i].click() # click to appear hover over window
html = driver.page_source
soup = BeautifulSoup(html, "lxml")
days = soup.find_all("p", {"class": ['info-window__statistics-value']})
link = soup.find_all("a", {"class": ['info-window__property-link']})
target_list.append( {
days[0].text.replace('\n', '').replace(' ', ''),
link[0].attrs['href']
} )
driver.quit()

