alwex/php-casperjs

No such file or directory

Opened this issue · 6 comments

Hi,

I ran the example

$casper = new Casper();
$casper->setOptions(array('ignore-ssl-errors' => 'yes'));
$casper->start('http://www.google.com');
$casper->fillForm(
'form[action="/search"]',
array(
'q' => 'search'
),
true);
$casper->wait(5000);
$casper->capture(
array(
'top' => 0,
'left' => 0,
'width' => 800,
'height' => 600
),
'Browser/custom.png'
);
$casper->run();
var_dump($casper->getOutput());

I was expecting a png file and I got error below:

array(1) { [0]=> string(70) "Fatal: [Errno 2] No such file or directory; did you install phantomjs?" }
Both libraries are installed.

Any idea what seems to be the prob?

@anagnam hey I can't include Capser in my project for some reason and it tells me no Capser class found, can you tell me about your setup? Thanks

@RonCan remote the useless //namespace Browser;
Then add the final ?> in the end of the file.

After that, you can include the file directly:
include 'lib/php-casperjs-master/src/Browser/Casper.php';

And you are good to go!

alwex commented

is it still an issue?

I have the same problem ..
error :
array(1) { [0]=> string(70) "Fatal: [Errno 2] No such file or directory; did you install phantomjs?" }

while i installed phantom and casper

alwex commented

It seems that casperjs is not able to find phantomjs, you should configure your path to make phantomjs available anywhere.
for example:

export PATH=$PATH:/Users/Tom/Downloads/phantomjs-1.9.2/bin

Hi, I have the same problem . But I have solve this problem use blow code before run php's exec function;
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs"); exec('...');