The documentation for selenium/webdriver/remote/webdriver.py says:
"Controls a browser by sending commands to a remote server."
When you run it from the command line using xymoncmd, it will have access to your display and any browser that you have running. When xymon runs the same script as a task, it doesn't own the display, so it gets "connection refused".
Probably.
Ralph Mitchell
On Fri, Jan 27, 2017 at 11:53 AM, usa ims via Xymon <xymon at xymon.com> wrote:
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
---------- Forwarded message ---------- From: usa ims <usaims at yahoo.com> To: "xymon at xymon.com" <xymon at xymon.com> Cc: Date: Fri, 27 Jan 2017 16:46:08 +0000 (UTC) Subject: script won't run in tasks.cfg but it will on the command line Hi,
I have this Python Selenium script that works if I go into the '/usr/lib/xymon/server/bin/' and fire off 'xymoncmd' and execute the script -- it reports to the Xymon Display and life is peachy.
When I put the script in tasks.cfg, it runs at the desired internal of every two minutes but it errors out. The script uses a combination of a driver '/usr/local/bin/geckodriver' which I even gave 777 permissions on it and changed ownership to 'xymon:xymon'. The script also uses an executable script in '/usr/bin/firefox' which I gave '777' permissions on it. Any help will be greatly appreciated.
Here is the error message:
Fri Jan 27 11:37:39 2017 Traceback (most recent call last): File "/usr/lib/xymon/server/ext/wslcb_licensee.py", line 31, in <module> driver = webdriver.Firefox() File "/usr/local/lib/python2.7/dist-packages/selenium/ webdriver/firefox/webdriver.py", line 150, in __init__ keep_alive=True) File "/usr/local/lib/python2.7/dist-packages/selenium/ webdriver/remote/webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "/usr/local/lib/python2.7/dist-packages/selenium/ webdriver/remote/webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "/usr/local/lib/python2.7/dist-packages/selenium/ webdriver/remote/webdriver.py", line 236, in execute self.error_handler.check_response(response) File "/usr/local/lib/python2.7/dist-packages/selenium/ webdriver/remote/errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: connection refused