I have pulled a few things from other answers today (this for instance: open a browser page and take screenshot every n hour in python 3)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox()
browser.implicitly_wait(30)
browser.get('https://weather.com/en-AU/weather/today/l/ASXX0023:1:AS?Goto=Redirected')
time.sleep(10)
browser.save_screenshot('screen_shot.png')
browser.close()
this solution is working perfectly except I'm not sure how to execute in crontab.
i tried this after typing crontab -e then:
*/30 * * * * export DISPLAY=:0 /usr/local/bin/python3.9 /Users/path/script.py >> /path/screenshot.png
and it opens the firefox window, but the screenshot is Zero Bytes.. so it's close to what I want, but not quite there.
I tried a few other ways too - with script.sh - though I'm not to sure how to get that working either.
Also - it'd be good to add the time and date to the screenshot, so any help there is a blessing.
could you offer any guidance? Thanks!