title: Extracting texts from <li> items with selenium in Python
body: <p>I´m trying to get the text inside a /a tag in a nested ul-li structure. I locate all the "li", but can´t get the text inside a's.</p>
  
  <p>I´m using Python 3.7 and Selenium webdriver with Firefox driver.</p>
  
  <p>The corresponding HTML is:</p>
  
  <pre><code>[some HTML]
  
  &lt;ul class="dropdown-menu inner"&gt;
  &lt;!----&gt;
      &lt;li nya-bs-option="curso in ctrl.cursos group by curso.grupo" class="nya-bs-option first-in-group group-item"&gt;
          &lt;span class="dropdown-header"&gt;Cursos em Destaque&lt;/span&gt;
          &lt;a tabindex="0"&gt;Important TEXT 1&lt;/a&gt;
      &lt;/li&gt;
      &lt;!-- end nyaBsOption: curso in ctrl.cursos group by curso.grupo --&gt;
      &lt;li nya-bs-option="curso in ctrl.cursos group by curso.grupo" class="nya-bs-option group-item"&gt;
          &lt;span class="dropdown-header"&gt;Cursos em Destaque&lt;/span&gt;
          &lt;a tabindex="0"&gt;Important TEXT 2&lt;/a&gt;
      &lt;/li&gt;
      &lt;!-- end nyaBsOption: curso in ctrl.cursos group by curso.grupo --&gt;
      &lt;li nya-bs-option="curso in ctrl.cursos group by curso.grupo" class="nya-bs-option group-item"&gt;
          &lt;span class="dropdown-header"&gt;Cursos em Destaque&lt;/span&gt;
          &lt;a tabindex="0"&gt;Important TEXT 3&lt;/a&gt;
      &lt;/li&gt;
      &lt;!-- end nyaBsOption: curso in ctrl.cursos group by curso.grupo --&gt;
      &lt;li nya-bs-option="curso in ctrl.cursos group by curso.grupo" class="nya-bs-option group-item"&gt;
          &lt;span class="dropdown-header"&gt;Cursos em Destaque&lt;/span&gt;
          &lt;a tabindex="0"&gt;Important TEXT4&lt;/a&gt;
      &lt;/li&gt;
                              [another 100 &lt;li&gt;&lt;/li&gt; similar blocks]                  .
                                                  .
      &lt;li class="no-search-result" placeholder="Curso"&gt;
          &lt;span&gt;Unimportant TEXT&lt;/span&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  
  [more HTML]
  </code></pre>
  
  <p>I´ve tried the code below:</p>
  
  <pre class="lang-py prettyprint-override"><code>cursos = browser.find_elements_by_xpath('//li[@nya-bs-option="curso in ctrl.cursos group by curso.grupo"]')
  nome_curso = [curso.find_element_by_tag_name('a').text for curso in cursos]
  </code></pre>
  
  <p>I get the list with the correct number of items, but all of them = ''. Can anyone help me? Thks.</p>