$1. Under Linux and Mac, ChromeDriver can be configured to $PATH. First, you can put executable files in a directory, and you can choose any directories.
For example, put the current executable in the /usr/local/ directory and open the path with the following command.
1 open /usr/local/
Next, you can modify the ~/.profile file.
1 export PATH="$PATH:/usr/local/chromedriver"
After saving, the following commands are executed:
1 source ~/.profile
You can do the adding of the environment variable.
After the configuration is completed, it can be executed directly under the command line.
If the input console has the output shown in the figure below, it is proved that the environment variable of ChromeDriver is configured well. It
Then test it in the program and execute the following Python Code:
1 from selenium import webdriver 2 browser = webdriver.Chrome()
After running, if a blank Chrome browser is popped up, it is proved that all the configurations are all right. If there is no pop-up, please check every step before.
If you pop up and flicker, you may be incompatible with the ChromeDriver version and the Chrome version. Please change the ChromeDriver version.
If there is no problem, then you can use Chrome to do web crawling.
$2. PhantomJSTo configure
download address: http://phantomjs.org/download.html
link: https://pan.baidu.com/s/1szsDVPAFt9dTP20r0WciqQ password: khuq
download, decompress the compressed package to a folder below. Rename the folder to phantomjs.
can be entered into the /usr/local/ directory with the following commands to paste:
1 open /usr/local/
1 export PATH="$PATH:/usr/local/phantomjs/bin"
After successful configuration, you can test it under the command line. Input:
If you can enter the command line of PhantomJS, prove that the configuration is completed, as shown in the figure.