0

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.
martin
  • 33
  • 6

2 Answers2

1

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

Shawn
  • 4,064
  • 2
  • 11
  • 23
  • Thank you for your help. The error not show out on cmd screen but, the dropdown box still cannot click on. After performing your code, dropdown not opened. Could you help me more – martin Mar 01 '23 at 06:20
0

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()
Javad
  • 2,033
  • 3
  • 13
  • 23
martin
  • 33
  • 6