Python爬蟲學習——使用selenium和phantomjs爬取js動態加載的網頁


1.安裝selenium

pip install selenium
Collecting selenium
  Downloading selenium-3.4.1-py2.py3-none-any.whl (931kB)
    100% |████████████████████████████████| 942kB 573kB/s 
Installing collected packages: selenium
Successfully installed selenium-3.4.1

2.安裝phantomjs

下載地址:http://phantomjs.org/download.html

下載的版本是:phantomjs-2.1.1-linux-x86_64.tar.bz2

解壓下載好的文件,並把文件夾移動到/usr/local目錄下

sudo mv phantomjs-2.1.1-linux-x86_64 /usr/local/phantomjs

 在/etc/profile下添加,之后source /etc/profile

export PHANTOMJS_HOME=/usr/local/phantomjs
export PATH=$PATH:$PHANTOMJS_HOME/bin

測試是否安裝成功

phantomjs -v
2.1.1

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM