Before installing the Web Accessibility Analyzer API, ensure you have the following prerequisites:
- Python 3.8+ (Recommended: Python 3.9 or higher)
- Google Chrome Browser (Required for Selenium WebDriver)
- ChromeDriver (Compatible with your Chrome version)
- Gemini AI API Key (For AI-powered accessibility suggestions)
git clone https://github.com/ruxailab/ai-accessibility-api
cd accessibility-api# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThe application uses Selenium with Chrome WebDriver. Ensure Google Chrome is installed on your system. ChromeDriver will be managed automatically by Selenium.
- Download ChromeDriver from https://chromedriver.chromium.org/
- Extract and place in your system PATH
- Verify installation:
chromedriver --version
- Get your API key from Google AI Studio
- Open
app/lib/geminisuggester.py - Replace
"YOUR_GEMINI_API_KEY"with your actual API key:
genai.configure(api_key="your_actual_api_key_here")Security Note: In production, use environment variables instead of hardcoding API keys.
This should successfully fetch HTML content from a test website.
uvicorn app.main:app --reloadThe API will be available at:
- API Endpoint:
http://localhost:8000 - Interactive Documentation:
http://localhost:8000/docs - Alternative Documentation:
http://localhost:8000/redoc
uvicorn app.main:app --host 0.0.0.0 --port 8000FROM python:3.9-slim
# Install Chrome
RUN apt-get update && apt-get install -y \
wget \
gnupg \
unzip \
curl \
&& wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]docker build -t accessibility-api .
docker run -p 8000:8000 accessibility-api-
ChromeDriver Version Mismatch
- Ensure ChromeDriver version matches your Chrome browser version
- Update Chrome browser and ChromeDriver
-
Selenium WebDriver Issues
- Check if Chrome is installed and accessible
- Verify ChromeDriver is in PATH
- Try running in non-headless mode for debugging
-
Permission Errors
- Ensure proper file permissions
- Run with appropriate user privileges
-
Network Issues
- Check internet connectivity for fetching web pages
- Verify firewall settings don't block Chrome/ChromeDriver
-
API Key Issues
- Verify Gemini AI API key is correct
- Check API quota and billing status
- Check the logs for detailed error messages
- Ensure all dependencies are correctly installed
- Verify Python version compatibility
- Review Chrome and ChromeDriver compatibility
After successful installation:
- Visit
/docsendpoint for interactive API documentation - Test the API endpoints with sample URLs