Example #1
0
    def element_to_string(self, source, xpath="."):
        """Returns the string representation of the specified element.

        The element to convert to a string is specified using `source` and
        `xpath`. They have exactly the same semantics as with `Get Element`
        keyword.

        The returned string is in Unicode format and it does not contain any
        XML declaration.

        See also `Log Element`.
        """
        string = ET.tostring(self.get_element(source, xpath), encoding="UTF-8")
        return self._xml_declaration.sub("", string.decode("UTF-8")).strip()
Example #2
0
    def element_to_string(self, source, xpath='.'):
        """Returns the string representation of the specified element.

        The element to convert to a string is specified using `source` and
        `xpath`. They have exactly the same semantics as with `Get Element`
        keyword.

        The returned string is in Unicode format and it does not contain any
        XML declaration.

        See also `Log Element`.
        """
        string = ET.tostring(self.get_element(source, xpath), encoding='UTF-8')
        return self._xml_declaration.sub('', string.decode('UTF-8')).strip()