PhantomJS and CasperJS | ||
See Browser Automation.
|
How to install CasperJS and PhantomJS for Tiki | |
|
1.1.1. Test the installation | |
Create a file (ex.: scrape.php) with the following content setOptions(array( 'ignore-ssl-errors' => 'yes' )); // screen shoot of homepage $casper ->start('http://tiki.org') ->setViewPort(1024,800) ->waitForText('About Tiki') ->wait(200) ->capture( array( 'top' => 0, 'left' => 0, 'width' => 1024, 'height' => 800 ), 'custom-capture.png' ) ->run(); echo "The image was captured
|
1.1.2. Expose them system-wide (optional) | |
In case you need to run some custom programs on a server which require casperjs and phantomjs, you may expose those programs to the whole server so that they can get accessed system wide from the usual Imagine that your root tiki folder is ln -s /var/www/html/bin/casperjs /usr/bin/casperjs ln -s /var/www/html/bin/phantomjs /usr/bin/phantomjs
|
Troubleshooting | |
If you get the following error, just stop the script and try again later > Tiki\Composer\BootstrapCompiler::build > Tiki\Composer\CleanVendors::clean > PhantomInstaller\Installer::installPhantomJS - Installing phantomjs (1.9.8) Downloading: Connecting... Could not fetch https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2, please create a bitbucket OAuth token to to go over the API rate limit Follow the instructions on https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html to create a consumer. It will be stored in "/root/.composer/auth.json" for future use by Composer. Ensure you enter a "Callback URL" or it will not be possible to create an Access Token (this callback url will not be used by composer) Consumer Key (hidden):
To test, and check version [root@ ~]# phantomjs -v 1.9.8
|
Related links | |
|
Open Hub | |
alias
|