Я следовал this link и теперь, когда я печатаю phan
, а затем вкладку (\t
), он выполняет автозаполнение phantomJS.Запуск phantomjs на linux с использованием python
Но если я бегу 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', а не' phantomJS'. Введите 'which phantomjs', чтобы увидеть, где он установлен. –
@ArtjomB. Я обновил вопрос. –
Вы установили PhantomJS через npm? Проверьте, является ли это символической ссылкой или sh оберткой вокруг фактического исполняемого файла. –