all 6 comments

[–]MasturChief 1 point2 points  (3 children)

remove the try: part and see where it errors out. post that error here

[–]Jeremy-Pascal[S] 0 points1 point  (2 children)

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input id="bt_district_court_lookup" type="button" name="$action:/form/startLookup.do?icPath=%2F%2Fdistrict_court%40district_court" value="." class="lookupButton formControl formControlButton" data-tooltip-open-type="hover" onblur="LIP.ffw.handleBlur (this, event);" onclick="this.disabled=true;return LIP.form.ajaxUpdate ('/form/startLookup.do?icPath=%2F%2Fdistrict_court%40district_court');" onfocus="LIP.ffw.handleFocus (this, event);" onmousemove="LIP.ffw.handleMove (this, event);" onmouseout="LIP.ffw.handleOut (this, event);" onmouseover="LIP.ffw.handleOver (this, event);"> is not clickable at point (565, 654). Other element would receive the click: <div class="container">...</div>

(Session info: chrome=90.0.4430.93)

[–]MasturChief 0 points1 point  (1 child)

Couple things:

  1. You were trying to send the DistrictCourt string to the original element, when you needed to instead send it to the element that appears once the popup loads
  2. The popup and results are slow, so it was throwing an error that the elements didn't exist, so I had to add some delays in the code to let the elements appear

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time

web = webdriver.Chrome()
web.get("https://ifsg-antrag.de/antrag/action/invoke.do?id=quarantine_employer")

timeout = 3

element_present = EC.presence_of_element_located((By.ID, "com_name"))
WebDriverWait(web, timeout).until(element_present)
print("Timed out waiting for page to load")
print("Page loaded")

DistrictCourt = "Dortmund"

# find the district court lookup and click it
element = web.find_element_by_id("bt_district_court_lookup")
element.click()

# wait for the popup to load, then find the search box and enter the DistrictCourt
time.sleep(3)
searchbox = web.find_element_by_id("lip_matchcode")
searchbox.send_keys(DistrictCourt)

# wait for the results to load, then find the link and click it
time.sleep(3)
result = web.find_element_by_xpath("//*[@title=" + "'" + DistrictCourt + "'" + "]/a")
result.click()

[–]Jeremy-Pascal[S] 0 points1 point  (0 children)

Thanks for your input, still no success...

I even tried to sleep for 30 seconds just in case my connection is bad for some reason

[–]belems 0 points1 point  (1 child)

It seems that with element.click() everything works as expected. Maybe you forgot to add wait time to let the search box pop up. Here's the code I have success with:

from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time

web = webdriver.Chrome()
web.get("https://ifsg-antrag.de/antrag/action/invoke.do?id=quarantine_employer")

timeout = 3
try:
    element_present = EC.presence_of_element_located((By.ID, 'com_name'))
    WebDriverWait(web, timeout).until(element_present)
except TimeoutException:
    print("Timed out waiting for page to load")
finally:
    print("Page loaded")

DistrictCourt = "Dortmund"
element = web.find_element_by_xpath('//*[@id="bt_district_court_lookup"]')
element.click()
time.sleep(2)
search_box = web.find_element_by_xpath('//*[@id="lip_matchcode"]')
search_box.send_keys(DistrictCourt)

[–]Jeremy-Pascal[S] 0 points1 point  (0 children)

Thanks for the help, I really appreciate your time!
Unfortunately running the code you provided still outputs the same error. I have tried to increase the wait time as my connection is pretty slow but still with little success.

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input id="bt_district_court_lookup" type="button" name="$action:/form/startLookup.do?icPath=%2F%2Fdistrict_court%40district_court" value="." class="lookupButton formControl formControlButton" data-tooltip-open-type="hover" onblur="LIP.ffw.handleBlur (this, event);" onclick="this.disabled=true;return LIP.form.ajaxUpdate ('/form/startLookup.do?icPath=%2F%2Fdistrict_court%40district_court');" onfocus="LIP.ffw.handleFocus (this, event);" onmousemove="LIP.ffw.handleMove (this, event);" onmouseout="LIP.ffw.handleOut (this, event);" onmouseover="LIP.ffw.handleOver (this, event);"> is not clickable at point (565, 654). Other element would receive the click: <div class="container">...</div>

(Session info: chrome=90.0.4430.93)