A Python-based automation tool that interacts with ChatGPT’s web interface using the Marionette driver for Firefox. It enables users to programmatically send prompts and retrieve responses, ideal for scripting repetitive tasks or integrating ChatGPT into workflows.
- Interactive Prompting: Send prompts to ChatGPT’s web interface and retrieve responses programmatically.
- Two Modes:
chatgpt_loop.py: Interactive CLI for continuous prompting until the user exits.chatgpt_marionette.py: Single-prompt script for one-off interactions via command-line arguments.
- Robust Response Handling: Waits for stable ChatGPT responses, ensuring complete and accurate output.
- Error Handling: Gracefully handles missing elements and browser connection issues.
- Lightweight: Minimal dependencies, relying on
marionette-driverfor browser automation.
ChatGPT-Web-Automator/
├── chatgpt_loop.py # Interactive CLI for continuous ChatGPT prompting
├── chatgpt_marionette.py # Single-prompt script for one-off ChatGPT interactions
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore file
└── README.md # Project documentation
-
Clone the Repository:
git clone https://github.com/NabiBukhsh-AI/ChatGPT-Web-Automator.git cd ChatGPT-Web-Automator -
Set Up a Virtual Environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies: Ensure Python 3.8+ is installed. Install the required package:
pip install -r requirements.txt
-
Set Up Firefox and Marionette:
-
Interactive Mode (
chatgpt_loop.py):- Run the script:
python chatgpt_loop.py
- Enter prompts interactively in the CLI. Type
exitorquitto stop. - Example:
💬 Enter your prompt (or type 'exit' to quit): > What is the capital of France? 📝 Sending prompt... ⏳ Waiting for reply... 🧠 ChatGPT replied: The capital of France is Paris.
- Run the script:
-
Single-Prompt Mode (
chatgpt_marionette.py):- Run the script with a prompt as a command-line argument:
python chatgpt_marionette.py "What is the capital of France?" - Example output:
Prompt sent: What is the capital of France? 🧠 ChatGPT replied: The capital of France is Paris.
- Run the script with a prompt as a command-line argument:
-
Prerequisites:
- Ensure Firefox is running with Marionette enabled (
firefox --marionette) before running either script. - Log in to ChatGPT’s web interface in Firefox to ensure the scripts can interact with the prompt textarea.
- Ensure Firefox is running with Marionette enabled (
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/your-feature). - Open a Pull Request.
Please read CONTRIBUTING.md for more details (create this file if you wish to formalize contribution guidelines).
This project is licensed under the MIT License. See the LICENSE file for details.
Created by NabiBukhsh-AI. For feedback or suggestions, open an issue or contact me via GitHub.