我是 Python 和 Selenium 的新手,我想单击“Afficher plus”按钮this url https://www.seloger.com/professionnels/agences-immobilieres/paris-15eme-75/agency-61886.htm#?bd=Detail_Agenceb_ann.
我试过这段代码:
plus = driver.find_element_by_css_selector("button[class='b-btn b-
ghost']")
plus.click()
但它不起作用,我收到此错误:
selenium.common.exceptions.WebDriverException:消息:未知错误:元素...在点(390、581)处不可单击。其他元素将收到点击:...
您尝试单击的元素不可单击,或者可能重叠。
尝试通过执行 javascript click 函数来单击特定元素。
driver.execute_script("arguments[0].click();", element)
另一方面,您的页面可能尚未完全加载,因此元素可能尚不可点击,您可以使用等待条件:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable(By...)) //change selector
element.click();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)