0
Good morning, everyone!
I’m trying to extract information from the central bank website using Lenium with python. First let me explain that although there is an API to get the SELIC number, it only sends two decimal places, so it is not good for me.
The address is as follows:: https://www.bcb.gov.br/htms/selic/selicacumul.asp?frame=1
In him, what I need is:
- Select the radio button "Monthly";
- The "last" month in the Month and Year fields;
- Click on the "Query";
- Get the information that is displayed in "Accumulated Factor";
When trying to take the first step...
from selenium import webdriver
url = 'https://www.bcb.gov.br/htms/selic/selicacumul.asp?frame=1'
driver = webdriver.Chrome()
driver.get(url)
driver.find_element_by_xpath('/html/body/div[1]/div[1]/form/div[2]/div[5]/input').click()
I’ve also tried id and tried to wait for the shipment, but nothing worked.
Following error I get:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
driver.find_element_by_xpath('/html/body/div[1]/div[1]/form/div[2]/div[5]/input').click()
File "C:\Users\joaoluistr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\joaoluistr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\joaoluistr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\joaoluistr\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/div[1]/form/div[2]/div[5]/input"}
(Session info: chrome=83.0.4103.116)
Thanks in advance for the help, guys!
Perfect, Ewerton. Thank you!
– João Luis Rodrigues
But my name is not Ewerton kk
– Gabriel Faggione