Установка простая, если не считать того, что CasperJS version 1.1.0-beta3 at /usr/local/share/casperjs, using phantomjs version 1.9.8 (Casper пока рабтает только с предыдущей версия Phantom).
Кроме того, я решил выполнять скрипты casper из консоли REPL, для этого учусь запускать касперскрипты в командной строке phantomjs.
Хотя, пробовать будем потом, здесь только краткие фрагменты из документации.
В документации вот такие команды¶
git clone git://github.com/n1k0/casperjs.git
$ cd casperjs
$ ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
Я не смог найти, что занчит 'pwd' и решил, вместо выполнения последней неясной команды, установить Casperjs туда же, куда и Phantomjs
root@kali:~# git clone git://github.com/n1k0/casperjs.git
Cloning into 'casperjs'...
remote: Counting objects: 13597, done.
remote: Total 13597 (delta 0), reused 0 (delta 0), pack-reused 13597
Receiving objects: 100% (13597/13597), 8.81 MiB | 1.89 MiB/s, done.
Resolving deltas: 100% (7830/7830), done.
root@kali:~#
Передвинем все в ту же папку, где уже лежит phantomjs
root@kali:~# mv casperjs /usr/local/share
Теперь создадим символическую ссылку
root@kali:~# ln -sf /usr/local/share/casperjs/bin/casperjs /usr/local/bin/casperjs
root@kali:~# casperjs
CasperJS version 1.1.0-beta3 at /usr/local/share/casperjs, using phantomjs version 1.9.8
Usage: casperjs [options] script.[js|coffee] [script argument [script argument ...]]
casperjs [options] test [test path [test path ...]]
casperjs [options] selftest
casperjs [options] __selfcommandtest
Options:
--verbose Prints log messages to the console
--log-level Sets logging level
--help Prints this help
--version Prints out CasperJS version
--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs
Read the docs http://docs.casperjs.org/
root@kali:~#
Yes, you can call a CasperJS script directly with the phantomjs executable, but if you do so, you must set the phantom.casperPath property to the path where the library root is located on your system:
/ casperscript.js
phantom.casperPath = '/path/to/casperjs';
phantom.injectJs(phantom.casperPath + '/bin/bootstrap.js');
var casper = require('casper').create();
// ...
#You can run such a script like any other standard PhantomJS script:
$ phantomjs casperscript.js
If you’re on Windows, this is the way you may manage to get casper working the most easily:
phantom.casperPath = 'C:\\path\\to\\your\\repo\\lib\\casperjs-0.6.X';
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js');
var casper = require('casper').create();
// do stuff
Приложение. Пытаюсь понять, что значит ln -sf pwd
/bin/casperjs /usr/local/bin/casperjs¶
!ln --help
Из info ln ... понятно, что ссылка может содежать строку, но не пойму сходу, зачем? ... Надеюсь, как нибудь потом дойдет...
Symbolic links can contain arbitrary strings; a "dangling symlink"
occurs when the string in the symlink does not resolve to a file.
There are no restrictions against creating dangling symbolic links.
There are trade-offs to using absolute or relative symlinks. An
absolute symlink always points to the same file, even if the directory
containing the link is moved. However, if the symlink is visible from
more than one machine (such as on a networked file system), the file
pointed to might not always be the same. A relative symbolic link is
resolved in relation to the directory that contains the link, and is
often useful in referring to files on the same device without regards
to what name that device is mounted on when accessed via networked
machines.
Посты чуть ниже также могут вас заинтересовать
Комментариев нет:
Отправить комментарий