我跟随this link,现在当我输入phan然后输入tab(\t)时,它会自动完成幻影JS。在
但是,如果我运行phantomJS -v或phantomJS --version,我得到:bash: /usr/local/bin/phantomjs: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
另外,如果我试着跑:
^{pr2}$
>>> import os
>>> driver = webdriver.PhantomJS(service_log_path=os.path.devnull)
Exception AttributeError: "'Service' object has no attribute 'log_file'" in > ignored
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
self.service.start()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
>>>
我的selenium/phatnomjs是否安装了正确的权限?在
我创建了一个目录/home/ec2-user/temp,并设置:chmod 777 /home/ec2-user/temp
但是>>> from selenium import webdriver
>>> driver = webdriver.PhantomJS(service_log_path='/home/ec2-user/temp/ghostdriver.log')
产量:Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
self.service.start()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 69, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
如果我输入which phantomjs我得到:$ which phantomjs
/usr/local/bin/phantomjs