public function tryRepeating(\Closure $closure, $time = null)
    {
        if (null === $time) {
            $time = $this->timeout;
        }

        $last = null;
        $count = 0;
        do {
            $count++;
            try {
                return $closure($this->getBrowser());
            } catch (\Exception $e) {
                $last = $e;
            }

            $wait = min(1000, $time);
            $time -= $wait;
            usleep($wait*1000);
        } while ($time > 0);

        throw new \RuntimeException(sprintf('Repeatedly failed, %s time: %s', $count, $last->getMessage()), 0, $last);

    }