from selenium import webdriver
from selenium.webdriver.common.by import By
import time
url = "https://remarketing.jyskefinans.dk/cars/?maerke=Citro%C3%ABn&model=C3"
# Initialize WebDriver
driver = webdriver.Chrome()
# Open the URL
driver.get(url)
# Wait for the cookie popup to appear (assuming it's an overlay)
time.sleep(2) # Adjust this delay as needed to ensure the popup is fully loaded
try:
# Find the accept all button and click it
accept_button = driver.find_element(By.CLASS_NAME, "coi-banner__accept")
accept_button.click()
except:
# If the accept button is not found or if there's any error, continue without accepting cookies
pass
try:
while True:
# Find the div element by its class name
div_element = driver.find_element(By.CLASS_NAME, "vehicles-export-container")
# Click the div element
div_element.click()
# Wait for 5 seconds
time.sleep(5)
except KeyboardInterrupt:
# Quit the WebDriver if a keyboard interrupt (Ctrl+C) is received
driver.quit()