1

I am trying to select the latest available date after clicking on the menu from the following website:

from selenium import webdriver
from selenium.webdriver.support.ui import Select
from _datetime import datetime
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys

url = "http://ausweisung.ivw-online.de/index.php?i=1161&a=o52802"
driver = webdriver.Chrome(executable_path = driver_path, chrome_options=chromeOptions)
driver.get("http://ausweisung.ivw-online.de/" + Link)
time.sleep(random.randint(7, 10))
driver.find_element_by_xpath('//*[@id="iform_ausweisung_szm"]/table/tbody/tr/td[3]/div/select').click()

However, even at the first step I get the following error:

ElementClickInterceptedException: element click intercepted: Element <select name="a" class="inaktiv" onchange="document.getElementById('iform_ausweisung_szm').submit();">...</select> is not clickable at point (875, 31). Other element would receive the click: <div class="bread">...</div>

How to get rid of the error ?

2 Answers 2

2

Here are 2 options to handle this issue.

Option 1: scroll to the select and then click

 listEle = driver.find_element_by_xpath('//*[@id="iform_ausweisung_szm"]/table/tbody/tr/td[3]/div/select')
 listEle.location_once_scrolled_into_view # this will scroll to the element
 #click on the element
 listEle.click()

Option 2: using javascript

 listEle = driver.find_element_by_xpath('//*[@id="iform_ausweisung_szm"]/table/tbody/tr/td[3]/div/select')
 #click using javascript
 driver.execute_script("arguments[0].click()",listEle)
Sign up to request clarification or add additional context in comments.

6 Comments

No, for some reason, it does not load the new page after clicking
Are you still getting ElementClickInterceptedException when clicked using one of the above options?
Basically, it skips that line, where it suppose to click
If add click to the first line I get ElementClickInterceptedException: element click intercepted: Element <select name="a" class="inaktiv" onchange="document.getElementById('iform_ausweisung_szm').submit();">...</select> is not clickable at point (875, 31). Other element would receive the click: <div class="bread">...</div>
Are you using option 1 or 2. Can you print(listEle) before clicking and make sure you are pointing to the right element.
|
1

Try having the element scroll into view:

xml_item = self.driver.find_element_by_name('//*[@id="iform_ausweisung_szm"]/table/tbody/tr/td[3]/div/select')
driver.execute_script("arguments[0].scrollIntoView(false);", xml_item)
xml_item.click() # Or any other action item.

In most cases, the issue is that the element is on the page somewhere, but it is not in the active window for selenium to take any action against it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.