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

asked Jul 2, 2021 at 17:20

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()
answered Jul 2, 2021 at 17:36

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
answered Jul 2, 2021 at 17:48

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)
answered Jul 2, 2021 at 21:30

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.