I would like to open a web page in a browser on raspberry by running a python selenium script every n hours from the crontab.
Its a pretty standard script that works if I run it locally on that machine.
So if i connect a keyboard to the raspberry and run
python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
it will open the browser and do the selenium commands that I need.
Now I can also ssh into the raspberry and run
export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
and I can see a browser open and do what I need on the monitor connected to the raspberry.
Now when I add this line to the cron.
57 9 * * * export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
I can see that cron executed the command if I check grep CRON /var/log/syslog
Jul 18 09:57:01 raspberrypi CRON[2971]: (pi) CMD (export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt)
But browser did not open on the monitor connected to the raspberry. What could I be doing wrong here? :)