PhantomJS with Selenium error: Message: 'phantomjs' executable needs to be in PATH

后端 未结 7 1854
灰色年华
灰色年华 2020-12-05 13:59

I am attempting to run this script:

https://github.com/Chillee/coursera-dl-all

However, the script fails at the line session = webdriver.PhantomJS()

7条回答
  •  一向
    一向 (楼主)
    2020-12-05 14:52

    Working Solution:

    Assumming you are on windows - it is similar for linux

    1) download phantomjs here: http://phantomjs.org/download.html pick windows/linux accordingly

    2) unzip your phantomjs-2.1.1-windows.zip and save it to for example c drive such as C:\phantomjs-2.1.1-windows\bin (in here there is a phantomjs.exe that is the execute that your system needs)

    3) On Windows10 edit your environment path to include this bin folder C:\phantomjs-2.1.1-windows\bin such as this example

    4) you may or may not restart your machine. Done! it should work! (Webdriver looks for phantomjs.exe and it should be ready now)

提交回复
热议问题