0

I'm trying to make Selenium click on a button to follow a link (it's the "Previous Month" button below the table): https://www.interactivebrokers.eu/en/index.php?f=39108

I tried the following

from selenium import webdriver

url = 'https://www.interactivebrokers.eu/en/index.php?f=39108'

driver = webdriver.Chrome("C:\\Users\\domen\\anaconda3\\Lib\\site-packages\\chromedriver_py\\chromedriver_win32.exe")

driver.get(url)
button = driver.find_element_by_css_selector('#monthly-interest-rates > div > div > div > div:nth-child(5) > a.btn.btn-sm.btn-default')
button.click()

but I get the following error: ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (367, 916). Other element would receive the click: ...

I got the same error with:

button = driver.find_element_by_link_text("Previous Month").click()

I also tried the following two alternatives:

button = driver.find_element_by_xpath('/html/body/div[3]/section[2]/div/div/div/div[2]/a[1]')
button = driver.find_element_by_class_name('btn btn-sm btn-default')

but I got: NoSuchElementException: Message: no such element: Unable to locate element

Does anyone can help? Thanks

3 Answers 3

1

You have to accept the cookies displayed at the bottom of the page

driver.find_element_by_xpath("//a[@id='btn_accept_cookies']").click()
Sign up to request clarification or add additional context in comments.

Comments

0
from selenium import webdriver
url = 'https://www.interactivebrokers.eu/en/index.php?f=39108'
driver = webdriver.Chrome("C:\\Users\\domen\\anaconda3\\Lib\\site- 
packages\\chromedriver_py\\chromedriver_win32.exe")

driver.get(url)
button = driver.find_element_by_xpath('//*[@id="monthly-interest- 
rates"]/div/div/div/div[2]/a[1]').click()
button

Comments

0

You can change .click() to .send_keys(Keys.ENTER).

I was trying that with the selector provided by you but it was clicking in another element, it was only going to second page, not downloading.

from selenium.webdriver.common.keys import Keys
button.send_keys(Keys.ENTER)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.