Selenium No Display Specified

I was using Selenium to automate some tasks beyond testing and needed to set it up to run with a cron job. A shell script calls the appropriate Maven command, but I kept getting the error:
Error: no display specified

The fix was to add this to the script before calling Maven:
export DISPLAY=:0

Evidently when Selenium is started from cron, it doesn’t know what display to use. This code tells it to use display 0 and it runs normally.


3 Replies to “Selenium No Display Specified”

Leave a Reply

Your email address will not be published. Required fields are marked *