I'm using BeautifulSoup to parse code from Craigslist. But when I'm using find_all command, I'm getting an empty list as output. If anyone could point out where I'm making a mistake or show me a better solution I would be grateful!
from selenium import webdriver
from bs4 import BeautifulSoup
from time import sleep
url = "https://vancouver.craigslist.org/search/cta?query=tesla#search=1~gallery~0~0"
driver = webdriver.Chrome()
driver.get(url)
soup = BeautifulSoup(driver.page_source, "html.parser")
sleep(4)
results = soup.find("div", class_="results")
print(results)
parent = results.find("ol")
# I can not accees <li> elements here
li_elements = parent.find_all("li", class_="cl-search-result cl-search-view-mode-gallery")
print(li_elements)
for li in li_elements:
print("not empty")
print(li.text)