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:
- Go to the practice site.
-  Locate the input field with ID = autosuggest.
- Type partial input like “aus”
- Wait for the dropdown suggestions to appear.
- Try to click on “Australia” or “British Indian Ocean Territory”.
- 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.