【RF库XML测试】Get Element Text

Name:
Get Element Text
Source:
XML <test library>
Arguments:
[ source | xpath=. | normalize_whitespace=False ]
Returns all text of the element, possibly whitespace normalized.
The element whose text to return is specified using `source` and `xpath`. They have exactly the same semantics as with `Get Element` keyword.
This keyword returns all the text of the specified element, including all the text its children and grandchildren contains. If the element has no text, an empty string is returned. As discussed in the `introduction`, the returned text is thus not always the same as the `text` attribute of the element.
Be default all whitespace, including newlines and indentation, inside the element is returned as-is. If `normalize_whitespace` is given any true value (e.g. any non-empty string), then leading and trailing whitespace is stripped, newlines and tabs converted to spaces, and multiple spaces collapsed into one. This is especially useful when dealing with HTML data.


Starting test: Test Rf Api.Testxml.Get Element Text
20170627 23:05:37.829 : INFO : ${firsttext} = text
20170627 23:05:37.830 : INFO :
Argument types are:
<type 'str'>
<type 'unicode'>
20170627 23:05:37.831 : INFO : ${secondtext} =
20170627 23:05:37.832 : INFO : Length is 0
20170627 23:05:37.834 : INFO :
${thirdtext} =
more text



20170627 23:05:37.835 : INFO : Length is 27
20170627 23:05:37.836 : INFO : ${thirdtextlen} = 27
20170627 23:05:37.837 : INFO : ${paragraph} = <Element 'p' at 0x02F7FA10>
20170627 23:05:37.838 : INFO : ${htmltext} = Text with bold and italics.
20170627 23:05:37.840 : INFO :
Argument types are:
<type 'str'>
<type 'unicode'>
Ending test: Test Rf Api.Testxml.Get Element Text

原文地址:https://www.cnblogs.com/apple2016/p/7087584.html