0
私はphan
と入力してからタブ(\t
)を入力すると、phantomJSにオートコンプリートします。this linkに続きました。Pythonを使用してLinux上でphantomjsを実行しています
しかし、私はphantomJS -v
またはphantomJS --version
を実行する場合、私は得る:
bash: /usr/local/bin/phantomjs: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
私が実行しようとします
>>> from selenium import webdriver
>>> driver = webdriver.PhantomJS()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 50, in __init__
service_args=service_args, log_path=service_log_path)
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/phantomjs/service.py", line 50, in __init__
service.Service.__init__(self, executable_path, port=port, log_file=open(log_path, 'w'))
IOError: [Errno 13] Permission denied: 'ghostdriver.log'
>>>
を私はthis I getに従うことをしようとした場合:
>>> import os
>>> driver = webdriver.PhantomJS(service_log_path=os.path.devnull)
Exception AttributeError: "'Service' object has no attribute 'log_file'" in <bound method Service.__del__ of <selenium.webdriver.phantomjs.service.Service object at 0x7f182ec13690>> ignored
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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.
>>>
されています私のセレン/ 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 "<stdin>", line 1, in <module>
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
大文字は本当に確かですか?それは通常「ファントムズ」であり、「ファントムズ」ではありません。どこにphantomjsがインストールされているかを確認するために ''どのファイルを入力しますか '' –
@ArtjomB。私は質問を更新しました。 –
PhantomJSをnpmでインストールしましたか?実際の実行可能ファイルのシンボリックリンクかshラッパーかを確認してください。 –