Home > Enterprise >  How to click button class in selenium
How to click button class in selenium

Time:01-29

How to click in this button in selenium?

<li title="Next Page" tabindex="0"  aria-disabled="false">
    <button  type="button" tabindex="-1">
        <span role="img" aria-label="right" >
           <svg viewBox="64 64 896 896" focusable="false" data-icon="right" 
           width="1em" height="1em" fill="currentColor" aria-hidden="true">

CodePudding user response:

driver.find_element(By.CSS_SELECTOR,"button.ant-pagination-item-link").click()

Just target the class name ant-pagination-item-link and click it.

Furthermore using webdriver waits we get the following. This allows for the site to load until the element is clickable and click it.

wait=WebDriverWait(driver,60)    
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button.ant-pagination-item-link"))).click()

Imports:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC

CodePudding user response:

Hey You can try the below code

class_element= driver.find_element_by_class('ant-pagination-item-link')
class_element.click()
        
  •  Tags:  
  • Related