title: Iteration through a list using Selenium
body: <p>I'm trying to iterate a limited number of <code>&lt;span&gt;</code> elements from html, which are actually lists generated from webdriver.</p>
  <p>I've tried doing this:</p>
  <pre><code>for i in range(9):
      print(driver.find_element(By.CSS_SELECTOR, &quot;thead &gt; tr th:nth-child(&quot;+[i]+&quot;) &gt; span&quot;).text)
  </code></pre>
  <p>And I received the following error:</p>
  <blockquote>
  <p>print(driver.find_element(By.CSS_SELECTOR, &quot;tbody &gt; tr
  td:nth-child(&quot;+[i]+&quot;) &gt; span&quot;).text) TypeError: can only concatenate
  str (not &quot;list&quot;) to str</p>
  </blockquote>
  <p>Here is the html snippet:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;thead&gt;&lt;tr class="C($tertiaryColor) Fz(xs) Ta(end)"&gt;&lt;th class="Ta(start) W(100px) Fw(400) Py(6px)"&gt;&lt;span&gt;Date&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;Open&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;High&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;Low&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;Close*&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;Adj Close**&lt;/span&gt;&lt;/th&gt;&lt;th class="Fw(400) Py(6px)"&gt;&lt;span&gt;Volume&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>It's all from this page: <a href="https://finance.yahoo.com/quote/BTC-EUR/history" rel="nofollow noreferrer">https://finance.yahoo.com/quote/BTC-EUR/history</a></p>