only headless mode – element is not clickable at point, Other element would receive the click

Question:

I tried to click on a dropdown box by Chrome Selenium python.
Chrome 110
python version 3

This box can be found OK, but when click() was performed, The error ElementClickIntercepted occured.
…Element MyElement is not clickable at point (x, y)… Other element would receive the click…
The abnormal that when i tried to click that box on UI mode(No –headless option), it’s OK, no error occurs. This error occurs only with –headless mode. It seems other element covered on my element. i cannot have solution for this

Someone please help me.

I tried serveral solution that i found in here such as

  • Wait object
  • Action Chains
  • Scroll to object
  • Maximum windows size
    But all of them are not working.
Asked By: martin

||

Answers:

Try using JavaScript to perform click() (assuming you haven’t tried it already)

element = driver.find_element(By.XPATH, "enter the XPath expression here/or any locator")
driver.execute_script("arguments[0].click();", element)

Reference: https://stackoverflow.com/a/75555555/7598774

Answered By: Shawn

Anyway, after trying many click methods. I found one method to select a directly value option in the dropdown menu. Here is code:

from selenium import webdriver

from selenium.webdriver.support.ui import Select

import time
 
# using chrome driver

driver=webdriver.Chrome()
 
# web page url

driver.get("https://fs2.formsite.com/meherpavan/form2/index.html?1537702596407")
 
# find id of option

x = driver.find_element_by_id('RESULT_RadioButton-9')

drop=Select(x)
 
# select by visible text

drop.select_by_visible_text("Afternoon")

time.sleep(4)
driver.close()
Answered By: martin
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.