-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: master
Are you sure you want to change the base?
Conversation
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" |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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() | ||
|
||
There was a problem hiding this comment.
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) | ||
|
||
There was a problem hiding this comment.
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) | ||
|
There was a problem hiding this comment.
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) | |||
|
|||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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))] | |||
|
|||
There was a problem hiding this comment.
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
Execucao da extracao
Ajuste para funcionar no novo site do bovespa.
Alterado para o driver do Chrome e novos nomes de elementos.