selenium-webdriverxpathclickwebdriverwaitjs-scrollintoview

How to click on the pagination element on binance.com website with Selenium Python


Can't click on found element with Selenium python. I'm trying to scrape the link:

https://www.binance.com/en/futures-activity/leaderboard/futures

I have successfully scraped the first page, however, I am trying to get to page 2. For this I use the following commands, but it is not working.

a = driver.find_element(By.XPATH,'//*[@id="page-2"]')
a.click()

Oddly, when I print(a) it finds the element, but unfortunately I can't click it. Print(a) answer:

<selenium.webdriver.remote.webelement.WebElement (session="9dbf9eafdc008e627b8b13face212b45", element="454a2787-33df-4067-b93a-8b73e259bebb")>

Solution

  • To click on Page 2 you need to scrollIntoView() the element first then inducing WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:

    binance