40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from selenium import webdriver
|
|
from selenium.webdriver.chrome.service import Service
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.common.keys import Keys
|
|
import time
|
|
|
|
# Chemin vers ChromeDriver
|
|
CHROMEDRIVER_PATH = "./chromedriver" # Remplacez par le chemin correct
|
|
|
|
# Options pour Chrome
|
|
options = webdriver.ChromeOptions()
|
|
options.add_argument("--headless") # Mode sans interface graphique
|
|
options.add_argument("--disable-gpu")
|
|
options.add_argument("--window-size=1920,1080")
|
|
|
|
# Initialisation du driver
|
|
service = Service(CHROMEDRIVER_PATH)
|
|
driver = webdriver.Chrome(service=service, options=options)
|
|
|
|
try:
|
|
# Ouvrir la page
|
|
url = "https://www.consortiumdus.com/DUSS/Demande/Liste"
|
|
driver.get(url)
|
|
time.sleep(3) # Attendre le chargement
|
|
|
|
# Vérifier si une connexion est requise
|
|
if "login" in driver.current_url.lower():
|
|
print("Page de connexion détectée. Ajoutez ici le code pour la connexion.")
|
|
# Exemple : remplir un formulaire de connexion
|
|
# username_input = driver.find_element(By.ID, "username")
|
|
# password_input = driver.find_element(By.ID, "password")
|
|
# username_input.send_keys("votre_identifiant")
|
|
# password_input.send_keys("votre_mot_de_passe")
|
|
# password_input.send_keys(Keys.RETURN)
|
|
# time.sleep(3) # Attendre la redirection
|
|
|
|
print("Navigation réussie !")
|
|
|
|
finally:
|
|
driver.quit() |