Exemplo n.º 1
0
 def __getattr__(self, name):
     if name == 'htmldoc':
         return self._get_htmldoc(self.doc)
     if name == 'htmlshortdoc':
         return utils.html_attr_escape(self.shortdoc)
     if name == 'htmlname':
         return utils.html_attr_escape(self.name)
     raise AttributeError("Non-existing attribute '%s'" % name)
Exemplo n.º 2
0
 def __getattr__(self, name):
     if name == 'htmldoc':
         return self._get_htmldoc(self.doc)
     if name == 'htmlshortdoc':
         return utils.html_attr_escape(self.shortdoc)
     if name == 'htmlname':
         return utils.html_attr_escape(self.name)
     raise AttributeError("Non-existing attribute '%s'" % name)
 def locator_for(self, locator, tagname):
     if self._is_predefined_strategy(locator):
         return locator
     locator = utils.html_attr_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))
Exemplo n.º 4
0
 def locator_for(self, locator, tagname):
     if self._is_predefined_strategy(locator):
         return locator
     locator = utils.html_attr_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))
 def _link_from_name(self, name, type_):
     return '<a name="%s_%s">%s</a>' % (type_, utils.html_attr_escape(name),
                                        utils.html_escape(name))
Exemplo n.º 6
0
 def _link_from_name(self, name, type_):
     return '<a name="%s_%s">%s</a>' % (type_, utils.html_attr_escape(name),
                                        utils.html_escape(name))
 def htmlname(self):
     return utils.html_attr_escape(self.name)
 def htmlshortdoc(self):
     return utils.html_attr_escape(self.shortdoc)
Exemplo n.º 9
0
 def htmlname(self):
     return utils.html_attr_escape(self.name)
Exemplo n.º 10
0
 def htmlshortdoc(self):
     return utils.html_attr_escape(self.shortdoc)