I am using a global PhantomJS on my Mac OS X for multiple Javascript and Python selenium projects. For the first time, I set up a virtual environnement using virtualenv :
virtualenv Python3.5 Path/To/MyEnvironnement
Then :
Path/To/MyEnvironnement . bin/activate which phantomjs
... returns my global selenium : /Users/Me/.npm-packages/bin/phantomjs
But every time I call :
driver = webdriver.PhantomJS(executable_path=r'/Users/Me/.npm-packages/bin/phantomjs')
I get this error :
Traceback (most recent call last): File "/Path/To/MyEnvironnement/script/spider/crawl/Urls.py", line 194, in <module> init_driver() File "/Path/To/MyEnvironnement/script/spider/crawl/Urls.py", line 29, in init_driver driver = webdriver.PhantomJS(executable_path=r'/Users/Me/.npm-packages/bin/phantomjs') File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__ self.service.start() File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 86, in start self.assert_process_still_running() File "/Path/To/MyEnvironnement/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 99, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service /Users/Me/.npm-packages/bin/phantomjs unexpectedly exited. Status code was: 127
It's been 24 hours since I first got this issue, and I read virtually all posts that could refer to it.
I tried, without success, to create a nodeenv inside my virtualenv : running phantomjs inside python virtualenv for selenium project