I have the following code that should click a cookie button. But for some reason it gives the error that is given below. Can someone tell me why It can't be clicked while the EC for the explicit wait is literally 'element_to_be_clickable'?
PATH = 'C:\Program Files (x86)\Chromedriver.exe'
driver = webdriver.Chrome(PATH)
driver.set_page_load_timeout(100)
driver.get(URL)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'accept-cookie-consent')))
driver.find_element_by_class_name('nlportal-cookie-consent-button').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, 'accept-cookie-consent')))
driver.find_element_by_class_name('nlportal-cookie-consent-button').click()
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME, 'content-loader__load-more-link')))
driver.find_element_by_class_name('content-loader__load-more-link').click()
This is the error I get:
Traceback (most recent call last):
File "C:\Users\axelz\PycharmProjects\ArbitrageBetting\ABFootball\ABBL\BLBookies\ABBLToto.py", line 5, in <module>
array = Toto(URL, 'Bundesliga')
File "C:\Users\axelz\PycharmProjects\ArbitrageBetting\ABFootball\ABFootballPackage\BookieFunctions.py", line 101, in Toto
driver.find_element_by_class_name('nlportal-cookie-consent-button').click()
File "C:\Users\axelz\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\axelz\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\axelz\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\axelz\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="nlportal-cookie-consent-button" type="button" id="accept-cookie-consent">...</button> is not clickable at point (77, 666). Other element would receive the click: <button class="nlportal-cookie-consent-button" type="button" id="accept-cookie-consent">...</button>
(Session info: chrome=92.0.4515.159)