public function spin($lambda)
    {
        $e = null;
        $timeLimit = time() + self::SPIN_TIMEOUT;
        do {
            try {
                $return = $lambda($this);
                if ($return) {
                    return $return;
                }
            } catch (\Exception $e) {
            }

            $this->sleep();
        } while ($timeLimit > time());

        throw new \Exception(
            'Timeout while retreaving DOM element' .
            ($e !== null ? '. Last exception: ' . $e->getMessage() : '')
        );
    }