'Helper method to get messages given title and details CSS.'

def _get_messages(self, title_css, details_css, wait_for_messages=False):

    if wait_for_messages:
        EmptyPromise((lambda : (len(self.q(css=self._bounded_selector(title_css)).results) != 0)), 'Waiting    for    messages    to    appear').fulfill()
    message_title = self.q(css=self._bounded_selector(title_css))
    if (len(message_title.results) == 0):
        return []
    messages = [message_title.first.text[0]]
    details = self.q(css=self._bounded_selector(details_css)).results
    for detail in details:
        messages.append(detail.text)
    return messages
