Skip to main content
Glama

MCP Selenium WebDriver

by Nixon-Suarez
  • Linux
  • Apple
test_windows_compatibility.py6.61 kB
#!/usr/bin/env python3 """ Script de prueba de compatibilidad con Windows para el servidor MCP Selenium WebDriver. """ import os import platform import sys from pathlib import Path def test_windows_compatibility(): """Prueba la compatibilidad del servidor con Windows.""" print("🔍 Probando compatibilidad con Windows...") print(f"Sistema operativo detectado: {platform.system()}") print(f"Versión: {platform.release()}") print(f"Arquitectura: {platform.architecture()[0]}") # Probar importaciones print("\n📦 Probando importaciones...") try: from browser_manager import WebDriverManager print("✅ browser_manager importado correctamente") except Exception as e: print(f"❌ Error al importar browser_manager: {e}") return False try: from browser_detection import BrowserDetection print("✅ browser_detection importado correctamente") except Exception as e: print(f"❌ Error al importar browser_detection: {e}") return False # Probar detección de navegadores print("\n🔍 Probando detección de navegadores...") try: detector = BrowserDetection() browsers = detector.detect_available_browsers() if "error" in browsers: print(f"❌ Error en detección: {browsers['error']}") else: print(f"✅ Navegadores detectados: {list(browsers.keys())}") for browser, info in browsers.items(): print(f" - {browser}: {info['path']} (v{info.get('version', 'N/A')})") except Exception as e: print(f"❌ Error en detección de navegadores: {e}") return False # Probar gestión de rutas print("\n📁 Probando gestión de rutas...") try: manager = WebDriverManager() # Probar detección de Chrome chrome_path = manager._get_browser_binary_path("chrome") if chrome_path: print(f"✅ Chrome encontrado en: {chrome_path}") else: print("⚠️ Chrome no encontrado en rutas predefinidas") # Probar detección de Firefox firefox_path = manager._get_browser_binary_path("firefox") if firefox_path: print(f"✅ Firefox encontrado en: {firefox_path}") else: print("⚠️ Firefox no encontrado en rutas predefinidas") except Exception as e: print(f"❌ Error en gestión de rutas: {e}") return False # Probar creación de directorios temporales print("\n📂 Probando gestión de directorios temporales...") try: import tempfile import shutil # Crear directorio temporal temp_dir = tempfile.mkdtemp(prefix="mcp_test_") print(f"✅ Directorio temporal creado: {temp_dir}") # Verificar que existe if os.path.exists(temp_dir): print("✅ Directorio temporal verificado") else: print("❌ Directorio temporal no existe") return False # Limpiar shutil.rmtree(temp_dir) print("✅ Directorio temporal limpiado") except Exception as e: print(f"❌ Error en gestión de directorios temporales: {e}") return False # Probar dependencias de Selenium print("\n🔧 Probando dependencias de Selenium...") try: from selenium import webdriver from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.webdriver.firefox.options import Options as FirefoxOptions from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.firefox import GeckoDriverManager print("✅ Dependencias de Selenium importadas correctamente") except Exception as e: print(f"❌ Error en dependencias de Selenium: {e}") return False # Probar undetected-chromedriver print("\n🕵️ Probando undetected-chromedriver...") try: import undetected_chromedriver as uc print("✅ undetected-chromedriver disponible") except ImportError: print("⚠️ undetected-chromedriver no disponible (opcional)") except Exception as e: print(f"❌ Error con undetected-chromedriver: {e}") print("\n🎉 Pruebas de compatibilidad completadas exitosamente!") return True def test_webdriver_manager_creation(): """Prueba la creación de WebDriverManager sin inicializar navegadores.""" print("\n🚀 Probando creación de WebDriverManager...") try: from browser_manager import WebDriverManager from config import BrowserOptions, ProxyConfig, DetectionEvasionConfig # Crear instancia manager = WebDriverManager() print("✅ WebDriverManager creado exitosamente") # Probar configuraciones browser_options = BrowserOptions( headless=True, incognito=True, no_sandbox=True, disable_dev_shm_usage=True ) print("✅ BrowserOptions creado exitosamente") detection_evasion = DetectionEvasionConfig( use_undetected_chrome=False, randomize_user_agent=True, randomize_viewport=True ) print("✅ DetectionEvasionConfig creado exitosamente") print("✅ Todas las configuraciones creadas correctamente") return True except Exception as e: print(f"❌ Error en creación de WebDriverManager: {e}") return False def main(): """Función principal.""" print("🔧 Servidor MCP Selenium WebDriver - Prueba de Compatibilidad con Windows") print("=" * 70) # Verificar que estamos en un entorno de prueba if platform.system().lower() == "linux": print("⚠️ Ejecutándose en Linux - Simulando compatibilidad con Windows") success = True # Ejecutar pruebas if not test_windows_compatibility(): success = False if not test_webdriver_manager_creation(): success = False # Resumen print("\n" + "=" * 70) if success: print("🎉 ¡Todas las pruebas de compatibilidad pasaron!") print("✅ El servidor debería funcionar correctamente en Windows") else: print("❌ Algunas pruebas fallaron") print("⚠️ Revisar los errores antes de usar en Windows") return 0 if success else 1 if __name__ == "__main__": sys.exit(main())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Nixon-Suarez/MCP-Selenium-WebDriver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server