public function wait($timeout, $condition)
    {
        $conditionResult = false;
        while ($timeout > 0 && true !== $conditionResult) {
            usleep(100);
            $timeout -= 100;

            // don't throw exceptions
            try {
                $conditionResult = $this->con->evaluateJavascript($condition);
            } catch (\Exception $e) {
                $conditionResult = false;
            }
        }

        return (boolean) $conditionResult;
    }