Spaces:
Build error
Build error
update browser
Browse files- src/agents/browser.py +5 -27
src/agents/browser.py
CHANGED
@@ -60,34 +60,11 @@ def initialize_driver():
|
|
60 |
|
61 |
print("Démarrage de l'initialisation du navigateur Chrome...")
|
62 |
|
63 |
-
|
64 |
-
chrome_options.add_argument("--force-device-scale-factor=1")
|
65 |
-
chrome_options.add_argument("--window-size=1600,1400")
|
66 |
-
chrome_options.add_argument("--disable-pdf-viewer")
|
67 |
-
chrome_options.add_argument("--window-position=0,0")
|
68 |
-
|
69 |
-
# Options essentielles pour l'environnement conteneurisé
|
70 |
-
chrome_options.add_argument("--no-sandbox")
|
71 |
-
chrome_options.add_argument("--disable-dev-shm-usage")
|
72 |
-
chrome_options.add_argument("--disable-gpu")
|
73 |
-
chrome_options.add_argument("--disable-extensions")
|
74 |
-
chrome_options.add_argument("--disable-software-rasterizer")
|
75 |
-
chrome_options.add_argument("--no-first-run")
|
76 |
-
chrome_options.add_argument("--no-zygote")
|
77 |
-
chrome_options.add_argument("--single-process")
|
78 |
-
|
79 |
-
# Path to Chrome binary
|
80 |
-
chrome_path = os.environ.get("CHROME_PATH", "/usr/bin/google-chrome-stable")
|
81 |
-
if os.path.exists(chrome_path):
|
82 |
-
print(f"Utilisation de Chrome à l'emplacement: {chrome_path}")
|
83 |
-
chrome_options.binary_location = chrome_path
|
84 |
-
|
85 |
-
# Afficher les options pour le diagnostic
|
86 |
-
print(f"Options Chrome configurées: {chrome_options.arguments}")
|
87 |
-
|
88 |
try:
|
89 |
-
print("Tentative de démarrage de Chrome avec Helium...")
|
90 |
-
|
|
|
91 |
print("Chrome démarré avec succès!")
|
92 |
|
93 |
# Informations sur le navigateur
|
@@ -108,6 +85,7 @@ def initialize_driver():
|
|
108 |
# Vérifier si Chrome est disponible
|
109 |
try:
|
110 |
import subprocess
|
|
|
111 |
chrome_version_cmd = f"{chrome_path} --version"
|
112 |
version_output = subprocess.check_output(chrome_version_cmd, shell=True, stderr=subprocess.STDOUT).decode()
|
113 |
print(f"Version de Chrome installée: {version_output.strip()}")
|
|
|
60 |
|
61 |
print("Démarrage de l'initialisation du navigateur Chrome...")
|
62 |
|
63 |
+
# Approche simplifiée comme dans minimal-helium-experiment
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
try:
|
65 |
+
print("Tentative de démarrage de Chrome avec Helium (méthode simplifiée)...")
|
66 |
+
# Lancer Chrome avec seulement l'option headless, sans options complexes
|
67 |
+
driver = helium.start_chrome(headless=True)
|
68 |
print("Chrome démarré avec succès!")
|
69 |
|
70 |
# Informations sur le navigateur
|
|
|
85 |
# Vérifier si Chrome est disponible
|
86 |
try:
|
87 |
import subprocess
|
88 |
+
chrome_path = os.environ.get("CHROME_PATH", "/usr/bin/google-chrome-stable")
|
89 |
chrome_version_cmd = f"{chrome_path} --version"
|
90 |
version_output = subprocess.check_output(chrome_version_cmd, shell=True, stderr=subprocess.STDOUT).decode()
|
91 |
print(f"Version de Chrome installée: {version_output.strip()}")
|