I need to get Id information by xpath using selenium for this html structure:
<div class="content">
<ul>
<li class="info-holder">
<h3 style=""><a href="#" style="">Information</a></h3>
<div class="tabela-lista-valor">
<p class="outer tabela-lista-item"> Id </p>
<p class="inner" style="font-family: 'Open Sans', Arial, Helvetica, sans-serif !important;margin-bottom: 0px;padding: 8px 8px;">1</p>
</ul>
</div>
But with using selenium to retrieve the data I receive this message:
TypeError: 'WebElement' object is not subscriptable
This is my code:
for z in range(2):
id_test = navegador.find_element(By.XPATH,"(//p[contains(concat(' ', normalize-space(@class), ' '),' inner ')])[1]")
for i in range(1,500):
dados_temporarios = {'ID': id_test[i].text}
dados.append(dados_temporarios)
navegador.find_element(By.XPATH, "//a[contains(text(),'next')]").click()