This Python script provides a simple solution for automatically reloading a web page whenever specified file types within a monitored directory are modified. It utilizes the watchdog
library to monitor file system events and the selenium
library for browser automation.
- Supports various web browsers: Firefox, Chrome, Edge, and Safari.
- Monitors a specified folder for changes in specified file extensions.
- Reloads the web page upon detecting a file modification.
- Python 3.x
- Dependencies:
watchdog
,selenium
-
Install the required dependencies:
pip install watchdog selenium
-
Download the script
code_sync_browser.py
.
--browser
(-b
): Browser type. Choices: ['firefox', 'chrome', 'edge', 'safari'].--path
(-p
): Path to the folder to watch for changes.--url
(-u
): Page URL to open in the browser.--extensions
(-e
): Extensions to watch for changes.--recursive
(-r
): Watch subfolders recursively.
python code_sync_browser.py -b chrome -p /path/to/watch -u http://example.com -e .html .css -r
This script is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please read the CONTRIBUTING guidelines before submitting pull requests.
- This script uses the
watchdog
andselenium
libraries.
Note: Make sure to have the appropriate web driver executable for the chosen browser in your system's PATH.
Disclaimer: This script is provided as-is without any warranty. Use it responsibly and in compliance with the terms of service of the websites you are automating.