attr_contains_word

returns True if the attribute value contains the given word.

Arguments

Source


def attr_contains_word(self, attr, value):
    a = self.attr(attr)
    if a is not None:
        val = re.compile('\\b' + value + '\\b')
        if val.search(a) is not None:
            return True
    return False