Tôi đang cố gắng để chạy PhantomJS lái xe trong Python nhưng tôi nhận được lỗi. Tôi đã đọc rằng tôi nên vượt qua toàn bộ con đường như một đối số nhưng nó đã không giúp đỡ.Selenium/PhantomJS tăng lỗi
Đây là mã:
from selenium import webdriver
# driver = webdriver.Chrome('D:\Python_projects\chromedriver_win32/chromedriver.exe') # this works
driver = webdriver.PhantomJS(executable_path='D:\Python\phantomjs-2.0.0-windows\bin\phantomjs.exe')
LỖI:
Traceback (most recent call last):
File "path to script", line 8, in <module>
driver = webdriver.PhantomJS(executable_path='D:\Python\phantomjs-2.0.0-windows\bin\phantomjs.exe')
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 50, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 75, in start
raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
selenium.common.exceptions.WebDriverException: Message: Unable to start phantomjs with ghostdriver.
Screenshot: available via screen
Bạn có biết những gì tôi làm sai?
@MalikBrahimi tài liệu nói rằng đường dẫn đến thực thi cần được - https://selenium.googlecode.com/svn/ trunk/docs/api/py/webdriver_phantomjs/selenium.webdriver.phantomjs.webdriver.html – fixxxer
Tại sao không thêm thư mục chứa tệp thi hành trong đường dẫn hệ thống? –
Không thể repro với Selenium 2.44.0 và PhantomJS 2.0.0 trên Windows. –