I'm trying to iterate a limited number of <span>
elements from html, which are actually lists generated from webdriver.
I've tried doing this:
for i in range(9):
print(driver.find_element(By.CSS_SELECTOR, "thead > tr th:nth-child("+[i]+") > span").text)
And I received the following error:
print(driver.find_element(By.CSS_SELECTOR, "tbody > tr td:nth-child("+[i]+") > span").text) TypeError: can only concatenate str (not "list") to str
Here is the html snippet:
<thead><tr class="C($tertiaryColor) Fz(xs) Ta(end)"><th class="Ta(start) W(100px) Fw(400) Py(6px)"><span>Date</span></th><th class="Fw(400) Py(6px)"><span>Open</span></th><th class="Fw(400) Py(6px)"><span>High</span></th><th class="Fw(400) Py(6px)"><span>Low</span></th><th class="Fw(400) Py(6px)"><span>Close*</span></th><th class="Fw(400) Py(6px)"><span>Adj Close**</span></th><th class="Fw(400) Py(6px)"><span>Volume</span></th></tr></thead>
It's all from this page: https://finance.yahoo.com/quote/BTC-EUR/history