如何在硒中单击此按钮?
<li title="Next Page" tabindex="0" class="ant-pagination-next" aria-disabled="false">
<button class="ant-pagination-item-link" type="button" tabindex="-1">
<span role="img" aria-label="right" class="anticon anticon-right">
<svg viewBox="64 64 896 896" focusable="false" data-icon="right"
width="1em" height="1em" fill="currentColor" aria-hidden="true">
driver.find_element(By.CSS_SELECTOR,"button.ant-pagination-item-link").click()
只需针对类名和分页项目链接并点击它。
此外,使用webdriver等待,我们得到以下内容。这允许网站加载,直到元素可以点击并点击它。
wait=WebDriverWait(driver,60)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button.ant-pagination-item-link"))).click()
进口:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
嘿,你可以试试下面的代码
class_element= driver.find_element_by_class('ant-pagination-item-link')
class_element.click()