【RF库XML测试】Get Elements

Name:
Get Elements
Source:
XML <test library>
Arguments:
[ source | xpath ]
Returns a list of elements in the `source` matching the `xpath`.
The `source` can be a path to an XML file, a string containing XML, or an already parsed XML element. The `xpath` specifies which element to find. See the `introduction` for more details.
Elements matching the `xpath` are returned as a list. If no elements match, an empty list is returned. Use `Get Element` if you want to get exactly one match.

Starting test: Test Rf Api.Testxml.Get Elements
20170627 21:56:38.428 : INFO : ${children} = [<Element 'child' at 0x02FD9B18>, <Element 'child' at 0x02FD9B48>]
20170627 21:56:38.429 : INFO : Length is 2
20170627 21:56:38.430 : INFO : more text
20170627 21:56:38.431 : INFO : None
20170627 21:56:38.432 : INFO : ${children} = []
20170627 21:56:38.433 : INFO : Length is 0
20170627 21:56:38.434 : INFO : ${children} = [<Element 'child' at 0x02FD9CB0>, <Element 'child' at 0x02FD99B0>, <Element 'child' at 0x02FD9C80>]
20170627 21:56:38.435 : INFO : Length is 3
20170627 21:56:38.436 : INFO : ${elements} = [<Element 'second' at 0x02FD9BC0>, <Element 'second' at 0x02FD9DE8>]
20170627 21:56:38.438 : INFO : Length is 2
20170627 21:56:38.439 : INFO : {'id': '2'}
20170627 21:56:38.440 : INFO : {'id': 'child'}
20170627 21:56:38.441 : INFO : ${b} = <Element 'b' at 0x033E5020>
20170627 21:56:38.442 : INFO :
Argument types are:
<type 'str'>
<type 'unicode'>
20170627 21:56:38.443 : INFO : ${id} = <Element 'second' at 0x02FD9E60>
20170627 21:56:38.444 : INFO : Length is 1
20170627 21:56:38.446 : INFO : ${elem} = <Element 'second' at 0x02FD9D40>
20170627 21:56:38.446 : INFO :
Argument types are:
<type 'str'>
<type 'unicode'>
20170627 21:56:38.448 : INFO : ${elem} = <Element 'child' at 0x033E50F8>
20170627 21:56:38.449 : INFO :
Argument types are:
<type 'str'>
<type 'unicode'>
20170627 21:56:38.451 : INFO : ${elem} = <Element 'child' at 0x033E5068>
20170627 21:56:38.452 : INFO :
Argument types are:
<type 'NoneType'>
<type 'NoneType'>
Ending test: Test Rf Api.Testxml.Get Elements

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