attr_contains_prefix

returns True if attribute of the element starts with given value.

Arguments

Source


def attr_contains_prefix(self, attr, value):
    a = self.attr(attr)
    if a is not None:
        if a.find(value) == 0 and a[len(value)] == '-':
            return True
    return False