Пример #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)
Пример #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))
Пример #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))
Пример #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)
Пример #9
0
 def htmlname(self):
     return utils.html_attr_escape(self.name)
Пример #10
0
 def htmlshortdoc(self):
     return utils.html_attr_escape(self.shortdoc)