Italy publishes its laws on the official "Gazzetta Ufficiale" website.
This is a sample page on which you can see that within a div with id=elenco_hp there is a long list of spans.
I am trying to understand how to iterate through the spans and when I find one like <span class="emettitore">AGENZIA ITALIANA DEL FARMACO</span>
then fetch all of the subsequent href strings contained in the following <span class="risultato">
spans (one or several) UNTIL I I read a "rubrica" or "emettitore" span.
I tried the following code but it does not work:
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver.get("https://www.gazzettaufficiale.it/gazzetta/serie_generale/caricaDettaglio?dataPubblicazioneGazzetta=2021-05-19&numeroGazzetta=118")
elems = driver.find_elements_by_class_name("risultato")
links = [elem.get_attribute("href") for elem in elems]
for link in links:
print(link)
but only get around 20 prints of None.