'How to click button class in selenium

How to click in this button in selenium?

<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">



Solution 1:[1]

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

Solution 2:[2]

Hey You can try the below code

class_element= driver.find_element_by_class('ant-pagination-item-link')
class_element.click()
        

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arundeep Chohan
Solution 2 Arham Sanghvi