Severity:

Medium

Context: 

While taking a Selenium course on Udemy, the instructor provided a demo website to practice with. Everything was going smoothly until I tested the autosuggestive dropdown using partial inputs for certain countries (e.g., “aus”, “roon”, “fr”)

Issue:  For some country names, like Australia,France or British Indian Ocean Territory, clicking the desired suggestion failed. Selenium threw a ElementClickInterceptedException

Steps to Reproduce:

  1. Go to the practice site.
  2.  Locate the input field with ID = autosuggest.
  3. Type partial input like “aus”
  4. Wait for the dropdown suggestions to appear.
  5. Try to click on “Australia” or “British Indian Ocean Territory”.
  6. Observe that Selenium throws an ElementClickInterceptedException

Actual Result:

When trying to select “Australia”, Selenium throws an ElementClickInterceptedException.

Fixed:

The issue is resolved by using JavaScript to perform the click action directly on the element, bypassing any other elements that may block the click. The following code achieves this:


driver.find_element(By.ID, “autosuggest”).send_keys(“au”)


for country in countries:

if country.text == “Australia”:

driver.execute_script(“arguments[0].click();”, country)

break



time.sleep(5)

Lesson learnt:

“If .click() doesn’t click, let JavaScript do the trick”



Let’s connect! I share real bugs, solutions, and QA tips regularly.