def locator_for(self, locator, tagname):
     if self._is_predefined_strategy(locator):
         return locator
     locator = attribute_escape(locator)
     tagname = self._synonyms.get(tagname, tagname)
     if tagname not in self._tag_attributes:
         return locator
     xpath_attributes = ['%s="%s"' % (attr, locator) for attr in
                         self._tag_attributes[tagname]]
     xpath_attributes.extend(self._get_attrs_requiring_full_url(
             self._tag_attributes[tagname], locator))
     return "xpath=//%s[%s]" % (tagname, ' or '.join(xpath_attributes))
Exemple #2
0
 def _link_from_name(self, name, type_):
     return '<a name="%s_%s">%s</a>' % (type_, utils.attribute_escape(name),
                                        utils.html_escape(name))