'Sets text and/or tail text of the specified element.
The element whose text to set is specified using ``source`` and
``xpath``. They have exactly the same semantics as with `Get Element`
keyword. The resulting XML structure is returned, and if the ``source``
is an already parsed XML structure, it is also modified in place.
Element\'s text and tail text are changed only if new ``text`` and/or
``tail`` values are given. See `Element attributes` section for more
information about `text` and `tail` in general.
Examples using ``${XML}`` structure from `Example`:
| Set Element Text       | ${XML} | new text | xpath=first    |
| Element Text Should Be | ${XML} | new text | xpath=first    |
| Set Element Text       | ${XML} | tail=&   | xpath=html/p/b |
| Element Text Should Be | ${XML} | Text with bold&italics. | xpath=html/p  | normalize_whitespace=yes |
| Set Element Text       | ${XML} | slanted  | !! | xpath=html/p/i |
| Element Text Should Be | ${XML} | Text with bold&slanted!! | xpath=html/p  | normalize_whitespace=yes |
Can only set the text/tail of a single element. Use `Set Elements Text`
to set the text/tail of multiple elements in one call.'

def set_element_text(self, source, text=None, tail=None, xpath='.'):

    source = self.get_element(source)
    element = self.get_element(source, xpath)
    if (text is not None):
        element.text = text
    if (tail is not None):
        element.tail = tail
    return source
