Spaces:
Build error
Build error
update chrome options
Browse files- src/agents/browser.py +16 -6
src/agents/browser.py
CHANGED
@@ -60,19 +60,29 @@ def initialize_driver():
|
|
60 |
|
61 |
print("Démarrage de l'initialisation du navigateur Chrome...")
|
62 |
|
63 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
try:
|
65 |
-
print("Tentative de démarrage de Chrome avec Helium
|
66 |
-
#
|
67 |
-
driver = helium.start_chrome(headless=True)
|
68 |
print("Chrome démarré avec succès!")
|
69 |
|
70 |
# Informations sur le navigateur
|
71 |
print(f"Version de Chrome: {driver.capabilities.get('browserVersion', 'Inconnue')}")
|
72 |
print(f"Plateforme: {driver.capabilities.get('platformName', 'Inconnue')}")
|
73 |
|
74 |
-
#
|
75 |
-
driver.set_page_load_timeout(
|
|
|
|
|
76 |
|
77 |
return driver
|
78 |
except Exception as e:
|
|
|
60 |
|
61 |
print("Démarrage de l'initialisation du navigateur Chrome...")
|
62 |
|
63 |
+
# Configuration minimale mais suffisante pour éviter les timeouts
|
64 |
+
chrome_options = webdriver.ChromeOptions()
|
65 |
+
# Options essentielles pour l'environnement conteneurisé
|
66 |
+
chrome_options.add_argument("--no-sandbox")
|
67 |
+
chrome_options.add_argument("--disable-dev-shm-usage")
|
68 |
+
# Options pour améliorer les performances
|
69 |
+
chrome_options.add_argument("--disable-gpu")
|
70 |
+
chrome_options.add_argument("--disable-extensions")
|
71 |
+
|
72 |
try:
|
73 |
+
print("Tentative de démarrage de Chrome avec Helium...")
|
74 |
+
# Utiliser les options minimales mais avec le mode headless
|
75 |
+
driver = helium.start_chrome(headless=True, options=chrome_options)
|
76 |
print("Chrome démarré avec succès!")
|
77 |
|
78 |
# Informations sur le navigateur
|
79 |
print(f"Version de Chrome: {driver.capabilities.get('browserVersion', 'Inconnue')}")
|
80 |
print(f"Plateforme: {driver.capabilities.get('platformName', 'Inconnue')}")
|
81 |
|
82 |
+
# Augmenter le délai d'attente pour le chargement des pages
|
83 |
+
driver.set_page_load_timeout(60) # Augmenté à 60 secondes
|
84 |
+
# Augmenter le délai d'attente pour les scripts
|
85 |
+
driver.set_script_timeout(60) # Augmenté à 60 secondes
|
86 |
|
87 |
return driver
|
88 |
except Exception as e:
|