Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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()))
Ejemplo n.º 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()))