public function evaluateJavascript($expression, $limit = null)
    {
        $key = '___lastValue___' . uniqid();
        $this->executeStep(
            sprintf("_sahi.setServerVarPlain(%s, JSON.stringify(%s))", json_encode($key), $expression),
            $limit
        );

        $resp = $this->executeCommand('getVariable', array('key' => $key));

        return json_decode($resp, true);
    }
public function evaluateJavascript($expression, $limit = null)
    {
        $key = '___lastValue___' . uniqid();
        $this->executeStep(
            sprintf("_sahi.setServerVarPlain(%s, JSON.stringify(%s))", json_encode($key), $expression),
            $limit
        );

        $resp = $this->executeCommand('getVariable', array('key' => $key));

        return json_decode($resp, true);
    }
public function evaluateJavascript ( $ expression , $ limit = null ) { $ key = '___lastValue___' . uniqid ( ) ; $ this -> executeStep ( sprintf ( "_sahi.setServerVarPlain(%s, JSON.stringify(%s))" , json_encode ( $ key ) , $ expression ) , $ limit ) ; $ resp = $ this -> executeCommand ( 'getVariable' , array ( 'key' => $ key ) ) ; return json_decode ( $ resp , true ) ; }
Evaluates JS expression on the browser and returns it's value.

@param string  $expression JS expression
@param integer $limit      time limit (value of 10 === 1 second)

@return mixed
Evaluates JS expression on the browser and returns it s value .