Download the PhantomJS binary for Windows from the official website: http://phantomjs.org/download.html
Extract the downloaded zip file to a folder on your system. For example, you can extract it to the "C:\phantomjs" folder.
Add the PhantomJS executable to the system path. This allows you to run PhantomJS from any location on your system.
- Go to "Control Panel" > "System and Security" > "System" > "Advanced system settings" > "Environment Variables"
- Under "System Variables" scroll down and find the "Path" variable, then click on "Edit"
- Click on "New" and add the path to your PhantomJS executable: "C:\phantomjs\bin"
- click OK
Verify the installation by opening a Command Prompt window and running:
phantomjs --version
It should display the version of PhantomJS that you have installed.
- If you are using PhantomJS for web scraping, you may need to install additional libraries such as
beautifulsoup4
andrequests
.
You can install them via pip
pip install beautifulsoup4 pip install requests
Note:
- PhantomJS 2.1.1 is not the latest version, it's not recommended to use it for production and security reasons, also it's not supported by the community anymore.
- You need to have Python installed on your machine to be able to use pip commands.
- You can also install other extension that support PhantomJS like
slimerjs
ortriflejs