Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python selenium请等待,直到所有my list元素都可单击为止_Python_Selenium_Web Scraping - Fatal编程技术网

Python selenium请等待,直到所有my list元素都可单击为止

Python selenium请等待,直到所有my list元素都可单击为止,python,selenium,web-scraping,Python,Selenium,Web Scraping,这是我的密码: 这个all_plus_图标返回一个包含页面10个元素的列表,我需要等待,直到所有这些元素都可以在selenium中单击,然后单击每个元素 all_plus_icons = driver.find_elements_by_xpath("//*[@id='block-views-tenders-block']/div/div/div[2]/div//div[1]/h5/span/i") for i in all_plus_icons: time.slee

这是我的密码: 这个all_plus_图标返回一个包含页面10个元素的列表,我需要等待,直到所有这些元素都可以在selenium中单击,然后单击每个元素

all_plus_icons = driver.find_elements_by_xpath("//*[@id='block-views-tenders-block']/div/div/div[2]/div//div[1]/h5/span/i")

for i in all_plus_icons:
    time.sleep(10)
    i.click()
上述代码有时会生成以下错误:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <i class="ic ac-icon-add"></i> is not clickable at point (831, 605). Other element would receive the click: <div class="cc_banner cc_container cc_container--open">...</div>
  (Session info: chrome=87.0.4280.88)
但它不起作用。如何确保所有元素都可单击。
这是网站。

似乎您需要接受Cookies来执行操作。在单击元素之前,请先尝试执行此操作:

driver.find_element_by_link_text('Got it!').click()
WebDriverWait(driver , 20).until_not(EC.presence_of_element_located((By.CLASS_NAME , "cc_banner")))
请尝试运行此代码

for i in all_plus_icons:
    time.sleep(10)
    i.click()
    driver.refresh

您是否正在关闭并处理cookie警告?如果您读取错误,它会告诉您元素
cc\u banner cc\u container cc\u container--open
将收到单击。打开chrome incognito,打开devtools,输入该标识符,它将显示cookie消息。@TalibDaryabi哪个元素是
?用HTML更新问题。
for i in all_plus_icons:
    time.sleep(10)
    i.click()
    driver.refresh