Chromedriver and PHANTOMJS configuration to $path

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.