我试图在单击以下网站的菜单后选择最新的可用日期:
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()
但是,即使在第一步,我也会得到以下错误:
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>
如何消除错误?你知道吗
这里有两个选项来处理这个问题。你知道吗
选项1:滚动至“选择”,然后单击
选项2:使用javascript
尝试将元素滚动到视图中:
在大多数情况下,问题是元素在页面的某个地方,但它不在活动窗口中,因此selenium无法对其采取任何操作。你知道吗
相关问题 更多 >
编程相关推荐