1

Here's the error:

ElementClickInterceptedException: Message: element click intercepted: Element <a href="report_exec_hc_1.php?report_id=...">SENECA01</a> is not clickable at point (100, 740). Other element would receive the click: <td align="center" class="footer" bgcolor="Black">...</td>

Here's the code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from getpass import getpass
from selenium.webdriver.common.by import By
from selenium.common.exceptions import WebDriverException
import time

opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_argument("--disable-extensions")
# Pass the argument 1 to allow and 2 to block
opt.add_experimental_option("prefs", { \
    "profile.default_content_setting_values.media_stream_mic": 1, 
    "profile.default_content_setting_values.media_stream_camera": 1,
    "profile.default_content_setting_values.geolocation": 1, 
    "profile.default_content_setting_values.notifications": 1 
  })

PATH = ("C:\\Users\\me\\AppData\\Local\\Programs\\Python\\Python39\\chromedriver.exe")
driver = webdriver.Chrome(PATH, chrome_options=opt)
wait = WebDriverWait(driver, 5)

driver.get("https://example.org/logon/login")
print(driver.title)

username = input("Enter in your username: ")
password = getpass("Enter your password: ")

username_textbox = driver.find_element_by_id("username")
username_textbox.send_keys(username)

password_textbox = driver.find_element_by_id("password")
password_textbox.send_keys(password)

login_button = driver.find_element_by_class_name("formstylebut")
login_button.submit()

link = driver.find_element_by_link_text("BI (CAD)")
link.click()

link = driver.find_element_by_link_text("Run a Report")
link.click()

link = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "SENECA01")))
link = driver.find_element_by_link_text("SENECA01")
link.click()

Here's the long form of the error:

ElementClickInterceptedException          Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_26964/2946665400.py in <module>
     48 link = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "SENECA01")))
     49 link = driver.find_element_by_link_text("SENECA01")
---> 50 link.click()
     51 
     52 

c:\users\me\appdata\local\programs\python\python39\lib\site-packages\selenium\webdriver\remote\webelement.py in click(self)
     78     def click(self) -> None:
     79         """Clicks the element."""
---> 80         self._execute(Command.CLICK_ELEMENT)
     81 
     82     def submit(self):

c:\users\me\appdata\local\programs\python\python39\lib\site-packages\selenium\webdriver\remote\webelement.py in _execute(self, command, params)
    691             params = {}
    692         params['id'] = self._id
--> 693         return self._parent.execute(command, params)
    694 
    695     def find_element(self, by=By.ID, value=None):

c:\users\me\appdata\local\programs\python\python39\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    416         response = self.command_executor.execute(driver_command, params)
    417         if response:
--> 418             self.error_handler.check_response(response)
    419             response['value'] = self._unwrap_value(
    420                 response.get('value', None))

c:\users\me\appdata\local\programs\python\python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    241                 alert_text = value['alert'].get('text')
    242             raise exception_class(message, screen, stacktrace, alert_text)  # type: ignore[call-arg]  # mypy is not smart enough here
--> 243         raise exception_class(message, screen, stacktrace)
    244 
    245     def _value_or_default(self, obj: Mapping[_KT, _VT], key: _KT, default: _VT) -> _VT:

ElementClickInterceptedException: Message: element click intercepted: Element <a href="report_exec_hc_1.php?report_id=...">SENECA01</a> is not clickable at point (100, 740). Other element would receive the click: <td align="center" class="footer" bgcolor="Black">...</td>
Optik
  • 33
  • 2
  • 7

1 Answers1

0

In Your code

link = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "SENECA01")))
link = driver.find_element_by_link_text("SENECA01")
link.click()

You are using this link_text

SENECA01

This error

ElementClickInterceptedException: Message: element click intercepted: Element <a href="report_exec_hc_1.php?report_id=...">SENECA01</a> is not clickable at point (100, 740). Other element would receive the click: <td align="center" class="footer" bgcolor="Black">...</td>

implies that, the element you are trying to interact which is not in selenium viewport, thus other elements are receiving the click.

In order to solve this :

1. Use ActionChains

wait = WebDriverWait(driver, 30)    
ActionChains(driver).move_to_element(wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "FIRMI01")))).click().perform()

Import :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains

2. Scroll to that particular element

wait = WebDriverWait(driver, 30) 
driver.execute_script("arguments[0].scrollIntoView(true);", wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "FIRMI01"))))
cruisepandey
  • 28,520
  • 6
  • 20
  • 38