使用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


你可能感兴趣的:(工具使用/系统运维)