This project contains scripts to automatically refresh a webpage at specified intervals using Selenium WebDriver. Two versions of the script are provided: one using ChromeDriver and another using SafariDriver.
- Python 3.x
- Selenium package
- ChromeDriver (for
refresh.py
) - SafariDriver (for
refresh_with_safari.py
)
-
Install Selenium:
pip install selenium
-
Download ChromeDriver:
- Download the appropriate version of ChromeDriver for your operating system from here.
- Place the
chromedriver
executable in a known location and update theCHROMEDRIVER_PATH
inrefresh.py
.
-
Enable SafariDriver:
- SafariDriver comes pre-installed with Safari on macOS.
- Enable "Allow Remote Automation" in Safari's Develop menu.
-
Edit
refresh.py
:- Update the
CHROMEDRIVER_PATH
variable to the path where yourchromedriver
is located.
- Update the
-
Run the script:
python refresh.py
-
Follow the prompts:
- Enter the URL you want to refresh.
- Enter the refresh interval (in seconds).
- Enter the number of times to refresh.
-
Run the script:
python refresh_with_safari.py
-
Follow the prompts:
- Enter the URL you want to refresh.
- Enter the refresh interval (in seconds).
- Enter the number of times to refresh.
Enter the URL you want to refresh: https://example.com
Enter the refresh interval (in seconds): 10
Enter the number of times to refresh: 5
The script will open the specified URL in the browser and refresh it at the specified interval for the specified number of times.
- Ensure that the web drivers are properly installed and configured.
- For Safari, make sure "Allow Remote Automation" is enabled in the Develop menu.
This project is licensed under the MIT License.