I am trying to create a scrapper that enters a website and downloads an XML file containing a balance sheet from real estate funds.
With the code below, I enter a website for a specific fund with document number 07000400000146 (at the end of URL), filter the documents with a search bar on the website, and click to download the first document in the table using XPath.
driver.get('https://fnet.bmfbovespa.com.br/fnet/publico/abrirGerenciadorDocumentosCVM?cnpjFundo=07000400000146')
driver.find_element_by_css_selector(f'input[type="search"]').click()
driver.find_element_by_css_selector(f'input[type="search"]').send_keys('informe mensal')
time.sleep(1)
driver.find_element_by_xpath('//*[@id="tblDocumentosEnviados"]/tbody/tr[1]/td[10]/div/a[2]/i').click()
How can I improve this code to click on the download button only for documents with '02/2020' on the column "Data de Referência"?