def text(self):
        """
        Retrieve the text of the element. If :data:`capybara.ignore_hidden_elements` is ``True``,
        which it is by default, then this will return only text which is visible. The exact
        semantics of this may differ between drivers, but generally any text within elements with
        ``display: none`` is ignored.

        Returns:
            str: The text of the element.
        """

        if capybara.ignore_hidden_elements or capybara.visible_text_only:
            return self.visible_text
        else:
            return self.all_text