使用casperjs訪問部分https站點返回空的問題

mac 10.11使用brew安裝的casperjs 1.0.4打開https站點時返回內容爲about:blank

1、查看casperjs版本發現

CasperJS version 1.0.4 at /usr/local/Cellar/casperjs/1.0.4/libexec, using PhantomJS version 1.8.2

我明明裝了phantomjs2.1.1,它在用的卻是1.8.2,猜測是phantomjs版本的問題

2、簡單升級casperjs,看是不是版本的問題:brew install casperjs --devel

3、查看版本:casperjs

CasperJS version 1.1.0-beta4 at /usr/local/Cellar/casperjs/1.1-beta4/libexec, using phantomjs version 1.9.8

再次打開https站點,果然可以了

執行的時候記得加上參數:casperjs --ignore-ssl-errors=yes --ssl-protocol=any test.js

建議,自己編譯安裝casperjs


4、phtntomjs+casperjs安裝

centos下:

    yum install git

    git clone git://github.com/ariya/phantomjs.git

    cd phantomjs

    git checkout 1.9

    ./build.sh

    //上面的方法我試了安裝失敗....

    可以試試方法二:

    下載phantomjs:http://download.csdn.net/detail/likunlun1234/9471008

    解壓縮:tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2

   之後加上軟鏈接:ln -sf /www/phantomjs/bin/phantomjs /usr/local/bin/phantomjs

    運行後可能會提示權限不足,修改/www/phantomjs/bin/phantomjs的權限爲755即可

casperjs 安裝

    git clone git://github.com/n1k0/casperjs.git

    ln -sf /www/casperjs/bin/casperjs /usr/local/bin/casperjs

windows下:下載對應的zip文件   解壓   添加到環境變量即可

mac下: 先brew update    brew install casperjs --devel  會自動安裝phantomjs


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章