playwright-to-exe is a tool that automates the process of transforming Python scripts that use the Playwright library into standalone executables (.exe) for Windows, making it easier to distribute web automation applications without requiring additional dependencies.
- Key Features
- Requirements
- How to Use
- Internal Operation
- Troubleshooting
- Contribution
- Credits
- License
- Other Languages
- 🚀 Complete Automation - Automated process from start to finish
- 🔧 Simplified Configuration - Just add your dependencies to the requirements.txt file
- 📦 Chromium Packaging - Includes the Chromium browser in the final executable
- 🔄 Virtual Environment - Creates and configures an isolated Python virtual environment
- ⚙️ PATH Configuration - Automatically adjusts Playwright environment variables
- 🖥️ Graphical Interface - Uses the auto-py-to-exe interface for final customization
- Python 3.8+ (Python 3.10 or higher recommended)
- Windows operating system
- Administrator permissions for package installation
Right-click here and select "Save link as..." to download the requirements.txt
file. Choose an empty directory where you want to save it.
- Open the
requirements.txt
file in a text editor - Add any additional libraries your project requires in section "2"
- Save the file after editing
IMPORTANT: Do not remove or modify the libraries listed in section "1".
Navigate to the empty folder where you saved the requirements.txt
file in step "1" and open PowerShell in that location:
- Right-click inside the folder while holding the Shift key
- Select "Open PowerShell window here"
Paste the following command into PowerShell and execute it:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex "&{$((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/A-Assuncao/playwright-to-exe/main/setup_install_venv.ps1'))}"
After execution, the auto-py-to-exe interface will open, where you can configure the final options for generating the executable.
The script automatically performs the following operations:
- Virtual environment creation: Isolates project dependencies
- Dependencies installation: Installs Playwright and its dependencies
- Playwright PATH configuration: Sets the
PLAYWRIGHT_BROWSERS_PATH="0"
environment variable - Chromium installation: Downloads and configures the Chromium browser
- auto-py-to-exe initialization: Opens the interface for final configuration
Problem | Solution |
---|---|
"Cannot execute scripts" | Run Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass before the main command |
Playwright installation failure | Check your internet connection and try again |
Error when packaging large files | Increase the memory limit in auto-py-to-exe in advanced settings |
Generated executable doesn't open | Check if all dependencies are listed in requirements.txt |
Contributions are welcome! Feel free to:
- Open Issues reporting bugs or suggesting improvements
- Send Pull Requests with fixes or new features
- Improve documentation or add examples
This solution was inspired by a step-by-step guide created by Animesh Singh on Medium.com. You can read the original guide here. Many thanks to Animesh Singh for providing the detailed instructions that formed the basis for this automated process!
This project is licensed under the MIT License. See the LICENSE file for details.
Developed with 💻 and Python.