1.ChromeDriver Configuration
2.PhantomJ Configuration
$. Under Linux and Mac, you can configure Chromedriver to $path. First, the executable file can be placed in a directory, and the directory can be arbitrarily selected.
For example, put the current executable in the/usr/local/directory, open the path with the following command,
1 open/usr/local/
You can then modify the ~/.profile file with the following commands:
1 export path="$PATH:/usr/local/chromedriver"
After saving, execute the following command:
1 Source ~/.profile
You can complete the addition of environment variables.
Once the configuration is complete, you can execute the command directly at the command line chromedriver
:
1 chromedriver
If the input console shows the output, it proves that the CHROMEDRIVER environment variable is configured.
Then test in the program and execute the following Python code:
1 from Import Webdriver 2 browser = Webdriver. Chrome ()
After running, if a blank Chrome browser pops up, it proves that all configurations are fine. If it does not pop up, check each step of the previous configuration.
If it pops up, it may be incompatible with the Chromedriver version and the chrome version, please replace the chromedriver version.
If there is no problem, then you can use Chrome to do the Web crawl.
$. PHANTOMJS Configuration
: http://phantomjs.org/download.html
Or
Link: Https://pan.baidu.com/s/1szsDVPAFt9dTP20r0WciqQ Password: Khuq
When the download is complete, unzip the package to a folder. Rename the folder to Phantomjs.
Paste the Phantomjs folder into the/usr/local/directory.
Use the following command to enter the/usr/local/directory for pasting:
1 open/usr/local/
Set path in Terminal:
1 export path="$PATH:/usr/local/phantomjs/bin"
After the configuration is successful, you can test it at the command line and enter:
1 Phantomjs
If you can go to the PHANTOMJS command line, it proves that the configuration is complete.
To verify the installation:
1 console.log ('hello')
Chromedriver and PHANTOMJS configuration to $path