Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajuste para funcionar no novo site do bovespa #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

viniciosi
Copy link

Ajuste para funcionar no novo site do bovespa.
Alterado para o driver do Chrome e novos nomes de elementos.

Ajuste para funcionar no novo site do bovespa.
Alterado para o driver do Chrome e novos nomes de elementos.
@@ -32,37 +32,42 @@
# Alguma definições
###############################################################################

baseurl = "http://www.bmfbovespa.com.br/cias-listadas/empresas-listadas/ResumoDemonstrativosFinanceiros.aspx"
#baseurl = "http://www.bmfbovespa.com.br/cias-listadas/empresas-listadas/ResumoDemonstrativosFinanceiros.aspx"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser retirado ao invés de comentado

itrdocid = 'ctl00_contentPlaceHolderConteudo_rptDocumentosITR_ctl%02d_lnkDocumento'
dfpdocid = 'ctl00_contentPlaceHolderConteudo_rptDocumentosDFP_ctl%02d_lnkDocumento'
grupoid1 = 'ctl00_cphPopUp_cmbGrupo_cmbGrupo'
#grupoid1 = 'ctl00_cphPopUp_cmbGrupo_cmbGrupo'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser retirado ao invés de comentado

grupoval1 = {
'i' : 'DFs Individuais',
'c' : 'DFs Consolidadas'
}
quadroid1 = 'ctl00_cphPopUp_cmbQuadro_cmbQuadro'
#quadroid1 = 'ctl00_cphPopUp_cmbQuadro_cmbQuadro'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser retirado ao invés de comentado

quadroval1 = {
'bpa' : 'Balanço Patrimonial Ativo',
'bpp' : 'Balanço Patrimonial Passivo',
'dre' : 'Demonstração do Resultado',
'dfc' : 'Demonstração do Fluxo de Caixa'
}
formframeid = 'ctl00_cphPopUp_iFrameFormulariosFilho'
#formframeid = 'ctl00_cphPopUp_iFrameFormulariosFilho'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser retirado ao invés de comentado

timeoutsleep = 1

headerxpath = "//table[@id='ctl00_cphPopUp_tbDados']//tr[1]//td"
tablexpath = "//table[@id='ctl00_cphPopUp_tbDados']//td"

asserttitle1 = '| Empresas Listadas | BM&FBOVESPA'
#asserttitle1 = '| Empresas Listadas | BM&FBOVESPA'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pode ser retirado ao invés de comentado

# Procura o link do documento para o periodo

itritem = getReportDocElem(itrdocid, trimester, year, driver)

assert itritem is not None

itritem.click()

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remover espaço em linhas vazias

clickDropDownItem(quadroid1, quadro, driver)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remover espaço em linhas vazias


# Seleciona a DRE individual

clickDropDownItem(grupoid1, grupo, driver)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remover linha vazia

@@ -72,7 +80,7 @@ def main(outfile):
# se assegura que ele exista e envia um clique

allbtn = driver.find_element_by_name(allbtnid)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remover espaço em linhas vazias

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Olá Caian. Estou tentando rodar o código para gerar a lista de empresas. Quando uso o asserttitle "Untitled Page", retorna um AssertionError. No meu caso funcionou com asserttitle = "Empresas Listadas". Porém o script não finaliza, gera erro quando tenta encontrar o allbtnid (allbtn = driver.find_element_by_name(allbtnid)): NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[name="ctl00$contentPlaceHolderConteudo$BuscaNomeEmpresa1$btnTodas"]"}
(Session info: chrome=79.0.3945.88)

@@ -93,7 +101,7 @@ def main(outfile):
table = [elem.text for
elem in
driver.find_elements_by_xpath((tablexpath))]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remover espaço em linhas vazias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants