Beispiel #1
0
 def xpath_class(self, class_selector):
     """Translate a class selector."""
     x = self.xpath(class_selector.selector)
     if is_non_whitespace(class_selector.class_name):
         x.add_condition(
             "%s and contains(concat(' ', normalize-space(%s), ' '), %s)"
             % ('@class', xpath_lower_case('@class'), self.xpath_literal(
                 ' '+class_selector.class_name.lower()+' ')))
     else:
         x.add_condition('0')
     return x
Beispiel #2
0
 def xpath_class(self, class_selector):
     """Translate a class selector."""
     x = self.xpath(class_selector.selector)
     if is_non_whitespace(class_selector.class_name):
         x.add_condition(
             "%s and contains(concat(' ', normalize-space(%s), ' '), %s)" %
             ('@class', xpath_lower_case('@class'),
              self.xpath_literal(' ' + class_selector.class_name.lower() +
                                 ' ')))
     else:
         x.add_condition('0')
     return x
Beispiel #3
0
 def xpath_hash(self, id_selector):
     """Translate an ID selector."""
     x = self.xpath(id_selector.selector)
     return self.xpath_attrib_equals(x, xpath_lower_case("@id"), (id_selector.id.lower()))
Beispiel #4
0
 def xpath_hash(self, id_selector):
     """Translate an ID selector."""
     x = self.xpath(id_selector.selector)
     return self.xpath_attrib_equals(x, xpath_lower_case('@id'),
                                     (id_selector.id.lower()))