End-to-end bid participation automation for the Government e-Marketplace of India.
From login and captcha solving to document upload and OTP verification — fully automated.
Features • Installation • Quick Start • Configuration • Architecture • Contributing
GeM BidPlus Automation handles the entire bid participation workflow on bidplus.gem.gov.in so you don't have to click through it manually.
- 🔐 Smart Login — Captcha OCR via Tesseract with manual fallback, OTP auto-fetch from email (IMAP)
- 🔍 Bid Search — Exact bid search and one-click participation
- 📋 Catalogue Offering — Automatic catalogue selection, encrypt & save
- 💰 Offer Price — Price entry, estimated price modal handling, encrypt & save
- 📄 Document Upload — Bulk upload mapped by document field keys with flexible file resolution
- 🏦 EMD/EPBG — Navigate and save
- ✅ Bid Verification — Consent checkbox, OTP verification (auto-fetch or manual)
- 🧠 Smart Flow Detection — Reads the sidebar progress indicator to resume from the current step
- 🛡️ Anti-Detection — Patchright (Playwright fork) with human-like delays, typing, scrolling, and mouse movement
| Dependency | Purpose |
|---|---|
| Python 3.11+ | Runtime |
| Google Chrome | Browser (stable channel) |
| Tesseract OCR | Captcha recognition |
# Ubuntu / Debian
sudo apt install tesseract-ocr
# macOS
brew install tesseract
# Windows — https://github.com/UB-Mannheim/tesseract/wikigit clone https://github.com/FlacSy/gem-automation.git
cd gem-automation
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
pip install -r requirements.txt
patchright install chromiumcp .env.example .env
# Edit .env with your GeM login, password, and (optionally) email for OTPpython main.pyThe script will:
- Open Chrome and navigate to GeM BidPlus
- Log in (captcha → password → OTP)
- Search for the specified bid and click Participate
- Run through all bid participation steps automatically
- Wait for you to press Enter before closing the browser
GEM_DEBUG=1 python main.pyEnables verbose logging and saves artifacts (HAR, traces, screenshots) to debug_logs/artifacts/.
| Variable | Required | Description |
|---|---|---|
GEM_LOGIN |
No* | GeM login ID |
GEM_PASSWORD |
No* | GeM password |
GEM_SEARCH_BID |
No* | Bid number for exact search |
GEM_EMAIL_IMAP_HOST |
No | IMAP server (default: imap.gmail.com) |
GEM_EMAIL_USER |
No | Email for OTP retrieval |
GEM_EMAIL_PASSWORD |
No | IMAP app password |
GEM_EMAIL_USE_SSL |
No | Use SSL for IMAP (1 / 0) |
GEM_UPLOAD_DOCUMENTS_DIR |
No | Directory with documents to upload |
GEM_UPLOAD_DOC_<KEY> |
No | Path to a specific document by field key |
GEM_DEBUG |
No | Enable debug mode (1 / 0) |
GEM_VERIFY_OTP |
No | Pre-set OTP for bid verification |
* Prompted interactively in the console if not set.
All CSS selectors, timeouts, delays, and flow-specific settings live in config.yaml. You rarely need to modify this file unless the GeM portal changes its markup.
The upload flow maps document fields (defined in config.yaml → upload_documents.document_fields) to files on disk. Resolution order:
- Environment variable —
GEM_UPLOAD_DOC_<KEY>(e.g.GEM_UPLOAD_DOC_EXPERIENCE_CRITERIA=/path/to/file.pdf) - Directory scan — matching filename from
GEM_UPLOAD_DOCUMENTS_DIR(seedocument_filename_by_keyin config) - Fallback —
GEM_UPLOAD_DOCUMENT_FILE
gem-automation/
├── main.py # Entry point
├── config.yaml # Selectors, timeouts, delays
├── logger.py # Logging (file + console in DEBUG)
├── browser/
│ ├── stealth_browser.py # Patchright Chrome launch
│ └── humanization.py # Human-like interactions
├── flows/
│ ├── base.py # BaseFlow ABC
│ ├── flow_detector.py # Bid participation state detection
│ ├── login.py # Login flow
│ ├── search.py # Search & participate
│ ├── catalogue.py # Catalogue offering
│ ├── offer_price.py # Offer price
│ ├── upload_documents.py # Document upload
│ ├── emd_epbg.py # EMD/EPBG
│ └── verify_bid.py # Verify bid with OTP
└── utils/
├── config.py # YAML + Pydantic config loader
└── email_client.py # IMAP OTP fetcher
Login → Search → [ Flow Detector ] → Catalogue → Offer Price → Upload Docs → EMD/EPBG → Verify Bid
↑ |
└──────────────── re-detect after each step ───────────────────┘
The Flow Detector reads the sidebar (ul.progress-indicator) to determine which step is current and which are already completed, so the automation always resumes from the right place.
This tool is provided for educational and research purposes. Use it responsibly and in compliance with GeM's terms of service. The authors are not responsible for any misuse or consequences arising from the use of this software.
Contributions are welcome! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch
- Commit your changes
- Open a Pull Request
Please open an Issue for bugs or feature requests.
This project is licensed under the MIT License — see LICENSE for details.
Developed with ❤️ by FlacSy