#!/usr/bin/env python3
"""
Simple test script to verify WebDriver functionality
"""

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
import time

def test_webdriver():
    """Test basic WebDriver functionality"""
    print("Initializing Chrome WebDriver...")
    
    # Set up Chrome options
    chrome_options = Options()
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--disable-dev-shm-usage")
    
    try:
        # Initialize the driver
        print("Creating WebDriver instance...")
        driver = webdriver.Chrome(options=chrome_options)
        
        print("WebDriver created successfully!")
        print("Loading Google homepage...")
        
        # Load a simple page to test
        driver.get("https://www.google.com")
        print(f"Page title: {driver.title}")
        
        # Wait a moment
        time.sleep(3)
        
        print("Test completed successfully!")
        driver.quit()
        return True
        
    except Exception as e:
        print(f"Error: {e}")
        return False

if __name__ == "__main__":
    success = test_webdriver()
    if success:
        print("\nWebDriver is working correctly!")
    else:
        print("\nWebDriver test failed!")