title: How to get the XML element text with ElementTree in Python
body: <p>I have some xml like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;robot generated="20161031 09:20:35.196" generator="Robot 3.0 (Python 2.7.10 on darwin)"&gt;
     &lt;suite source="/path/to/source" id="s1" name="App"&gt;
        &lt;kw type="setup" name="Login to App" library="SettingsAndLibraries"&gt;
           &lt;arguments&gt;
              &lt;arg&gt;${VALID USER}&lt;/arg&gt;
              &lt;arg&gt;${VALID PASSWORD}&lt;/arg&gt;
           &lt;/arguments&gt;
           &lt;kw name="Open Browser" library="Selenium2Library"&gt;
              &lt;doc&gt;Opens a new browser instance to given URL.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${LOGIN URL}&lt;/arg&gt;
                 &lt;arg&gt;${BROWSER}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;assign&gt;
                 &lt;var&gt;${BROWSER ID}&lt;/var&gt;
              &lt;/assign&gt;
              &lt;msg timestamp="20161031 09:20:35.920" level="INFO"&gt;Opening browser 'Chrome' to base url 'https://app.com/'&lt;/msg&gt;
              &lt;msg timestamp="20161031 09:20:40.668" level="INFO"&gt;${BROWSER ID} = 1&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:40.669" starttime="20161031 09:20:35.920" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Maximize Browser Window" library="Selenium2Library"&gt;
              &lt;doc&gt;Maximizes current browser window.&lt;/doc&gt;
              &lt;status status="PASS" endtime="20161031 09:20:40.940" starttime="20161031 09:20:40.669" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Set Selenium Speed" library="Selenium2Library"&gt;
              &lt;doc&gt;Sets the delay in seconds that is waited after each Selenium command.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${DELAY}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;status status="PASS" endtime="20161031 09:20:40.941" starttime="20161031 09:20:40.940" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Title Should Be" library="Selenium2Library"&gt;
              &lt;doc&gt;Verifies that current page title equals `title`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;Sign In - App&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:40.947" level="INFO"&gt;Page title is 'Sign In'.&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:40.948" starttime="20161031 09:20:40.941" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Input Text" library="Selenium2Library"&gt;
              &lt;doc&gt;Types the given `text` into text field identified by `locator`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${LOGIN.txtUser}&lt;/arg&gt;
                 &lt;arg&gt;${username}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:40.948" level="INFO"&gt;Typing text 'test' into text field 'ctl00_content_userNameText'&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:41.038" starttime="20161031 09:20:40.948" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Input Text" library="Selenium2Library"&gt;
              &lt;doc&gt;Types the given `text` into text field identified by `locator`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${LOGIN.txtPassword}&lt;/arg&gt;
                 &lt;arg&gt;${password}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:41.039" level="INFO"&gt;Typing text 'pw' into text field 'ctl00_content_passwordText'&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:41.129" starttime="20161031 09:20:41.038" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Input Text" library="Selenium2Library"&gt;
              &lt;doc&gt;Types the given `text` into text field identified by `locator`.&lt;/doc&gt;
              &lt;msg timestamp="20161031 09:20:41.129" level="INFO"&gt;Typing text 'text' into text field 'ctl00_content_Text'&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:41.209" starttime="20161031 09:20:41.129" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Click Button" library="Selenium2Library"&gt;
              &lt;doc&gt;Clicks a button identified by `locator`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${LOGIN.btnLogin}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:41.210" level="INFO"&gt;Clicking button 'ctl00_content_btnLogin'.&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:50.839" starttime="20161031 09:20:41.209" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Location Should Be" library="Selenium2Library"&gt;
              &lt;doc&gt;Verifies that current URL is exactly `url`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;${WELCOME URL}&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:50.846" level="INFO"&gt;Current location is 'https://app.com/home.aspx'.&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:50.846" starttime="20161031 09:20:50.839" /&gt;
           &lt;/kw&gt;
           &lt;kw name="Title Should Be" library="Selenium2Library"&gt;
              &lt;doc&gt;Verifies that current page title equals `title`.&lt;/doc&gt;
              &lt;arguments&gt;
                 &lt;arg&gt;Welcome to Home&lt;/arg&gt;
              &lt;/arguments&gt;
              &lt;msg timestamp="20161031 09:20:50.851" level="INFO"&gt;Page title is Welcome to Home'.&lt;/msg&gt;
              &lt;status status="PASS" endtime="20161031 09:20:50.851" starttime="20161031 09:20:50.847" /&gt;
           &lt;/kw&gt;
           &lt;status status="PASS" endtime="20161031 09:20:50.851" starttime="20161031 09:20:35.919" /&gt;
        &lt;/kw&gt;
        &lt;suite source="/path/to/source" id="s1-s1" name="Admin"&gt;
           &lt;suite source="/path/to/source" id="s1-s1-s1" name="Church Setup"&gt;
              &lt;suite source="/path/to/source" id="s1-s1-s1-s1" name="Buildings"&gt;
                 &lt;test id="s1-s1-s1-s1-t1" name="Verify Buildings Page"&gt;
                    &lt;kw name="Click Link" library="Selenium2Library"&gt;
                       &lt;doc&gt;Clicks a link identified by locator.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;${GLOBAL.lnkAdmin}&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;msg timestamp="20161031 09:20:50.873" level="INFO"&gt;Clicking link 'link=Admin'.&lt;/msg&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:50.968" starttime="20161031 09:20:50.873" /&gt;
                    &lt;/kw&gt;
                    &lt;kw name="Wait Until Element Is Visible" library="Selenium2Library"&gt;
                       &lt;doc&gt;Waits until element specified with `locator` is visible.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;nav_sub_6&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:51.432" starttime="20161031 09:20:50.968" /&gt;
                    &lt;/kw&gt;
                    &lt;kw name="Click Link" library="Selenium2Library"&gt;
                       &lt;doc&gt;Clicks a link identified by locator.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;${ADMIN.lnkBuildings}&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;msg timestamp="20161031 09:20:51.432" level="INFO"&gt;Clicking link 'link=Buildings'.&lt;/msg&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:52.224" starttime="20161031 09:20:51.432" /&gt;
                    &lt;/kw&gt;
                    &lt;kw name="Page Should Contain Element" library="Selenium2Library"&gt;
                       &lt;doc&gt;Verifies element identified by `locator` is found on the current page.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;ctl00_ctl00_MainContent_content_txtBuildingName&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;msg timestamp="20161031 09:20:52.248" level="INFO"&gt;Current page contains element 'ctl00_ctl00_MainContent_content_txtBuildingName'.&lt;/msg&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:52.249" starttime="20161031 09:20:52.224" /&gt;
                    &lt;/kw&gt;
                    &lt;kw name="Page Should Contain Button" library="Selenium2Library"&gt;
                       &lt;doc&gt;Verifies button identified by `locator` is found from current page.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;ctl00_ctl00_MainContent_content_btnSave&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;msg timestamp="20161031 09:20:52.268" level="INFO"&gt;Current page contains input 'ctl00_ctl00_MainContent_content_btnSave'.&lt;/msg&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:52.268" starttime="20161031 09:20:52.249" /&gt;
                    &lt;/kw&gt;
                    &lt;kw name="Page Should Contain Link" library="Selenium2Library"&gt;
                       &lt;doc&gt;Verifies link identified by `locator` is found from current page.&lt;/doc&gt;
                       &lt;arguments&gt;
                          &lt;arg&gt;link=Edit&lt;/arg&gt;
                       &lt;/arguments&gt;
                       &lt;msg timestamp="20161031 09:20:52.401" level="INFO"&gt;Current page contains link 'link=Edit'.&lt;/msg&gt;
                       &lt;status status="PASS" endtime="20161031 09:20:52.401" starttime="20161031 09:20:52.269" /&gt;
                    &lt;/kw&gt;
                    &lt;tags&gt;
                       &lt;tag&gt;Admin&lt;/tag&gt;
                       &lt;tag&gt;Smoke&lt;/tag&gt;
                       &lt;tag&gt;testrailid=627&lt;/tag&gt;
                    &lt;/tags&gt;
                    &lt;status status="PASS" endtime="20161031 09:20:52.401" critical="yes" starttime="20161031 09:20:50.872" /&gt;
                 &lt;/test&gt;
                 &lt;doc&gt;Verifies the Admin, Setup, Buildings Page&lt;/doc&gt;
                 &lt;status status="PASS" endtime="20161031 09:20:52.404" starttime="20161031 09:20:50.856" /&gt;
  </code></pre>
  
  <p>I would like to end up with a dictionary that contains the test names and the test docs.  Eg </p>
  
  <pre><code>`{'Verify Buildings Page': 'Verifies the Admin, Setup, Buildings Page'}`
  </code></pre>
  
  <p>The XML is much larger than this, I cut it short for this example.  Here's what I have so far.  How do I get the doc element text?</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  
  tree = ET.parse('../App/Logs/output.xml')
  
  root = tree.getroot()
  
  testName = []
  testDoc = []
  
  for test in root.iter('test'):
      testName.append(test.get('name'))
      #somehow get the test doc text here
  
  print testName
  </code></pre>