【发布时间】:2021-05-29 20:51:12
【问题描述】:
我一直在搜索该网站,但似乎找不到适合我的修复程序。我正在尝试单击应该加载更多评论的按钮。
driver.get("https://www.mediamarkt.nl/nl/product/_philips-essential-airfryer-xl-hd9260-90-1653991.html")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".bv-content-btn-pages-load-more"))).click()
是我正在使用的代码。这会导致错误:
selenium.common.exceptions.ElementClickInterceptedException: Message: Element <button class="bv-content-btn bv-content-btn-pages bv-content-btn-pages-load-more bv-focusable" type="button"> is not clickable at point (674,670) because another element <div class="gdpr-cookie-layer gdpr-cookie-layer--show"> obscures it
我尝试获取元素然后单击它:
element = driver.find_element_by_class_name('bv-content-btn-pages-load-more')
driver.execute_script("arguments[0].click();", element)
我也尝试过使用动作链:
element = driver.find_element_by_class_name('bv-content-btn-pages-load-more')
ActionChains(driver).move_to_element(element).click().perform()
这里的实际问题是什么,我该如何解决?
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver