import logging


def collect_element(tree, selector: str, default=""):
    """ Selects first element from html tree by selector and returns its text_content(), or default if element not found """
    elements = tree.xpath(selector)
    if not elements:
        logging.info("Collecting isn't possible by selector: %s", selector)
        return default
    return elements[0].text_content()