Q:

execute javascript with behat and phantomjs

I am working on a solution for functional test with javascript support. 
Naturally, using Symfony Framework, I choose Behat with Sahi driver, and I had my test suites  green.  The problem was that sahi is quite slow, and not stable enough and that is why I turn to PhantomJs as this blog post mentions:
-> http://shashikantjagtap.net/running-behat-scenarios-with-pahntomjs/
Some of my tests stay green, but when I use $this->getSession()->getDriver()->evaluateScript(), there is no return and I can't evaluate javascript. 
If someone ever deal with and found a solution ...
++

A:

You have not solved the problem?  Try it:
$this->getSession()->getDriver()->evaluateScript(
    "function(){ return 'some expression'; }()"
);

