I'm using Mac Mojave. I can run this command from my termianl (bash) successfully ...
PATH=/Users/davea/Documents/workspace/starter_project/selenium/dev/:$PATH selenium-side-runner -c "goog:chromeOptions.args=[--headless,--nogpu] browserName=chrome" /tmp/81a312ad-8fe1-4fb0-b93a-0dc186c3c585.side
I would like to run this from Python (3.7)/Django, so I wrote the below code
SELENIUM_RUNNER_CMD = "/usr/local/bin/selenium-side-runner"
SELENIUM_RUNNER_OPTIONS = 'goog:chromeOptions.args=[--headless,--nogpu] browserName=chrome'
SELENIUM_WORKING_DIR = "/Users/davea/Documents/workspace/starter_project/selenium/"
SELENIUM_DRIVER_PATH = "/Users/davea/Documents/workspace/starter_project/selenium/dev"
...
def execute_selenium_runner_file(file_path):
print("runner cmd:" + settings.SELENIUM_RUNNER_CMD)
new_env = os.environ.copy()
new_env['PATH'] = '{}:' + settings.SELENIUM_DRIVER_PATH + ':/usr/local/bin'.format(new_env['PATH'])
out = Popen([settings.SELENIUM_RUNNER_CMD, "-c", settings.SELENIUM_RUNNER_OPTIONS, file_path], cwd=settings.SELENIUM_WORKING_DIR, env=new_env, stderr=STDOUT, stdout=PIPE)
t = out.communicate()[0], out.returncode
return t
But when running through Python, the process dies with the following error ...
Running /tmp/c847a3ce-c9f2-4a80-ab2a-81d9636c6dab.side
Error: spawn find ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:19)
at onErrorNT (internal/child_process.js:431:16)
at processTicksAndRejections (internal/process/task_queues.js:84:17)
The exit code is "1". I'm not clear on what I need to do to get Python to execute my command line the same way I'm able to run it the same way I do through bash. Any advice is appreciated.