A Docker-based automation tool for posting classified ads using Selenium 4 with headless Chrome. Now featuring improved setup, configuration management, and cross-platform support for easier development and deployment.
- Python 3.8+ - Download here
- Docker & Docker Compose - Get Docker
- Git (optional) - For cloning the repository
Linux/macOS:
./setup.shWindows:
setup.batDevelopment setup:
./setup.sh --dev # Includes testing and development toolsWith Docker (Recommended):
make run
# or
docker compose up -d selenium && docker compose run --rm pythonLocal Development:
make run-local
# or
source venv/bin/activate && python main.pyVerify Setup:
make verify # Check setup completeness
make health-check # Test Selenium connectivityWe've added a Makefile for easy command management:
make help # Show all available commands
make setup # Set up the project
make setup-dev # Set up for development
make verify # Verify setup is working
make health-check # Check system health
make run # Run with Docker
make run-local # Run locally
make test # Run tests
make format # Format code
make lint # Run linting
make clean # Clean up generated filesCreate a .env file (automatically created from .env.example during setup):
# Required credentials
UDEC_USERNAME=your_username_here
UDEC_PASSWORD=your_password_here
# Optional configuration
SELENIUM_URL=http://selenium:4444/wd/hub
HEADLESS=true
WAIT_TIMEOUT=10
LOG_LEVEL=INFOCopy config.ini.example to config.ini and customize the automation behavior:
- Form data (title, description, phone, location)
- User ID in the create_ad_url
- Selenium timeouts and options
- URLs and endpoints
Important: Never commit your actual config.ini file as it contains personal information.
This project includes full VS Code support:
- DevContainer: Open in VS Code and use "Reopen in Container" for a complete development environment
- Extensions: Recommended extensions are automatically suggested
- Settings: Pre-configured Python, linting, and testing settings
# Set up development environment
./setup.sh --dev
# Activate virtual environment
source venv/bin/activate # Linux/macOS
# or
venv\Scripts\activate # Windows
# Run tests
make test
# or
python -m pytest
# Format code
make format
# or
black .
# Lint code
make lint
# or
flake8 *.py# Run all tests
make test
# Run tests with coverage
python -m pytest --cov=. --cov-report=html
# Run specific test file
python -m pytest tests/test_main.py -v# Start all services
docker compose up -d
# Run automation
docker compose run --rm python
# View Selenium in browser (for debugging)
# Visit http://localhost:7900 (password: secret)
# Stop services
docker compose down# Build images
docker compose build
# Start only Selenium
docker compose up -d selenium
# Run automation manually
docker compose run --rm python python main.py- Comprehensive logging to both console and file
- Better error messages with troubleshooting hints
- Environment validation before running
- Works on Windows, macOS, and Linux
- Platform-specific setup scripts
- Virtual environment automation
- Pre-commit hooks and code formatting
- Testing infrastructure with pytest
- Type checking with mypy
- Linting with flake8
- Environment variable validation
.envfile support with examples- Configurable automation parameters
- Separate development dependencies
- Console output with colored logging levels
- File logging to
automation.log - Configurable log levels (DEBUG, INFO, WARNING, ERROR)
- VNC access on port 7900 for visual debugging
- Health checks for service monitoring
- Better Chrome options for stability
# Run all tests
make test
# Run with coverage report
python -m pytest --cov=. --cov-report=html
open htmlcov/index.html # View coverage report"Docker not found"
- Install Docker Desktop from docker.com
- Make sure Docker service is running
"Python not found"
- Install Python 3.8+ from python.org
- Make sure Python is in your PATH
"Missing environment variables"
- Run setup script:
./setup.sh - Edit
.envfile with your credentials - Check
.env.examplefor reference
"Selenium connection failed"
- Start Selenium:
docker compose up -d selenium - Wait 30 seconds for Selenium to be ready
- Check Docker logs:
docker compose logs selenium
"Permission denied on setup.sh"
chmod +x setup.sh
./setup.shSet environment variables for debugging:
export LOG_LEVEL=DEBUG
export HEADLESS=false # See browser actions- Environment variables are not committed to git
.envfiles are automatically ignoredconfig.iniis ignored to prevent committing personal information- Always use
.env.exampleandconfig.ini.exampleas templates - Credentials and personal data are only stored locally
- Docker containers run with minimal privileges
If you're setting up this project for the first time:
- Copy
config.ini.exampletoconfig.ini - Copy
.env.exampleto.env - Edit both files with your actual credentials and information
- Never commit these files to version control
Note: Previous versions of this repository may have contained example data in config files. Always use the template files and never commit sensitive information.
- Fork the repository
- Set up development environment:
./setup.sh --dev - Create a feature branch
- Make your changes
- Run tests:
make test - Format code:
make format - Submit a pull request
This is free and unencumbered software released into the public domain. See LICENSE for details.
For issues and questions:
- Check the troubleshooting section above
- Review logs in
automation.log - Open an issue on GitHub with full error details