Selenium unable to find Button

Issue

I am trying to click on the "Next Page"-Button on the Web of Science Search-Site to iterate through all pages.
Here is a screenshot of the HTML of the page (highlighted is the button)
HTML

This is my code to find the button:

driver.find_element_by_class_name('mat-focus-indicator mat-icon-button mat-button-base').click()

But I receive this error:
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".mat-focus-indicator mat-icon-button mat-button-base"}

I have tried so many ways of identifying the button (find_by_id, find_by_name, find_by_link_text) but nothing works.

What am I doing wrong?

Thank you in advance

Solution

Maybe try with Query Selector like:

driver.find_element_by_css_selector('button[data-ta="next-page-button"]')

You can always try selectors on elemnts panel (like on screenshort) and type your selector in field "Find by string, css, or xpath"

Answered By – Kozubi

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published