Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-01-2012, 07:58 AM   #1
LQ Newbie
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
Smile Issue with cron scheduling python script which includes webdriver testcase


what am i trying to do?
Test a web page using selenium webdriver .python code is working fine when run from terminal.
problem comes when i use crontab to do the same.

These are the files.:
# crontab file :

crontab -l
49 12 * * * /home/sukhwinder/

#file "" :

export DISPLAY=:0
cd /home/sukhwinder

# file "" :

import time
import sys
import os

def main():
os.system('python /home/sukhwinder/')

if __name__ == '__main__':

#the error mailed by cron in /var/mail/root file is :
ERROR: test_enabling_personal_blacklist (__main__.EnablingPersonalBlacklist)
Traceback (most recent call last):
File "/home/sukhwinder/", line 9, in setUp
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/", line 51, in __init__
self.binary, timeout),
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/", line 47, in __init__
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/", line 44, in launch_browser
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/", line 81, in _wait_until_connectable
WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: No protocol specified\nError: cannot open display: :0\n'

Ran 1 test in 1.093s

FAILED (errors=1)

I don't know what is this error message suggesting.....please help

Last edited by Sukh; 08-01-2012 at 08:13 AM. Reason: making more readable
Old 08-03-2012, 01:37 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,339

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
cron run as a detached process, so it doesn't have a terminal/display to talk to ...
If you search around LQ you may find some sort of work around, but its not designed to use a terminal usually..
1 members found this post helpful.
Old 08-10-2012, 06:23 AM   #3
LQ Newbie
Registered: Aug 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Issue was resolved.
I included statement:
and it started running fine.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cron-tab issue(Task scheduling) amritpalpathak Linux - Software 4 04-10-2011 05:20 AM
[SOLVED] problem in scheduling script using /etc/cron.d etika Linux - Newbie 2 03-16-2011 09:39 AM
python rsync script runs from shell not from cron beanbox Programming 3 11-18-2009 07:23 PM
Unable to run Python script with cron terminally.confused Linux - Newbie 3 03-08-2009 03:06 PM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 03:54 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration