Linux crontab can not run with a graphical interface procedures? I completed a simple seleimun + chrome automatic login procedures in the test run time is OK to run, but in the crontab timing, I write , And wrote a simple control group, he did not run, what can I do?
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time,sys
driver = webdriver.Chrome()
driver.get("https://stackoverflow.com/users/login?ssrc=head&returnurl=http%3a%2f%2fstackoverflow.com%2fusers%2f7197440%2fa83533774%3ftab%3dtopactivity")
elem = driver.find_element_by_xpath('//*[@id="email"]')
elem.send_keys("******")
elem = driver.find_element_by_xpath('//*[@id="password"]')
elem.send_keys("***")
elem.send_keys(Keys.RETURN)
time.sleep(5)
name = time.ctime().replace(' ','-')+'.png'
driver.save_screenshot(name)
time.sleep(5)
print 'end',time.ctime()
driver.close()
crontab :
DISPLAY=:0 google-chrome
*/3 * * * * python ~/selenium_so.py >> log1.txt
*/1 * * * * date >> log.txt
I found this answer, but how do I practice him run selenium with crontab (python)
Thanks for the answer!