def element_id_by_label(browser, label):
    """Return the id of a label's for attribute"""
    label = XPathSelector(browser,
                          unicode('//label[contains(., "%s")]' % label))
    if not label:
        return False
    return label.get_attribute('for')
def element_id_by_label ( browser , label ) : label = XPathSelector ( browser , unicode ( '//label[contains(., "%s")]' % label ) ) if not label : return False return label . get_attribute ( 'for' )
Return the id of a label's for attribute