def driver_needed(func):
    """
    Decorator for WhatsappObject methods that need to communicate with the browser

    It ensures that the object receives a driver instance at construction

    :param func: WhatsappObject method
    :return: Wrapped method
    """
    def wrapped(self, *args):
        if not self.driver:
            raise AttributeError("No driver passed to object")

        return func(self, *args)

    return wrapped