alwex / php-casperjs

simple PHP wrapper for CasperJS
MIT License
182 stars 71 forks source link

Returning data from target page #44

Open wrabit opened 7 years ago

wrabit commented 7 years ago

In CasperJS I would write something like:

    title = this.evaluate(function() {
        return $.trim($('.title').text());
    });

How can I achieve the same with this wrapper?

davidgv88 commented 6 years ago

+1!

davidgv88 commented 6 years ago

Created Pull Request #51

davidgv88 commented 6 years ago

Whit this Pull Request you can do this:

$casper = new Casper(); $casper->start('http://example.com'); $casper->evaluateToVar('title','return $.trim($('.title').text());'); $casper->run();

$vars = $casper->getVars(); echo $vars['title'];