Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not find CasperJS #60

Closed
crouti opened this issue Sep 6, 2018 · 3 comments
Closed

Can not find CasperJS #60

crouti opened this issue Sep 6, 2018 · 3 comments

Comments

@crouti
Copy link

crouti commented Sep 6, 2018

Hi,

I am using php-casperjs in a wordpress plugin. I installed as recommended with

npm install phantomjs
npm install casperjs

then

composer require phpcasperjs/phpcasperjs

i can initialize casper without error like this:

try {
    $casperJSExecutable = trailingslashit(realpath(dirname(__FILE__) . '/node_modules/casperjs/bin/casperjs'));
    self::getLogger()->trace("Casper path : " . $casperJSExecutable);
    $this->casper = new Casper($casperJSExecutable, '/tmp');
} catch (Exception $e) {
    self::getLogger()->error($e->getMessage());
}

but as soon as i run it, the error in the title of this post appears

try {
    $this->casper->run();
} catch (Exception $e) {
    self::getLogger()->error("####### ERROR #######");
    self::getLogger()->error($e->getMessage());
    return null;
}

Any idea ?
Thanks a lot

@crouti
Copy link
Author

crouti commented Sep 11, 2018

Is there an other way i should use to pass to php-casperjs the path to casperjs executable, which is done here during Casper instanciation:

$casperJSExecutable = trailingslashit(realpath(dirname(__FILE__) . '/node_modules/casperjs/bin/casperjs'));
    self::getLogger()->trace("Casper path : " . $casperJSExecutable);
    $this->casper = new Casper($casperJSExecutable, '/tmp');

Is there a problem here ?
Thanks

@crouti
Copy link
Author

crouti commented Sep 11, 2018

Ok, the path was not good, need to provide the parent directory, not the exe file:

$casperJSExecutable = trailingslashit(realpath(dirname(__FILE__) . '/node_modules/casperjs/bin/'));

@crouti crouti closed this as completed Sep 11, 2018
@stickypages
Copy link

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants