-2

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

2
  • Can you share the URL?
    – pmadhu
    Sep 24, 2021 at 11:25
  • Please edit you question to include the HTML as code, rather than a screenshot. You can copy the HTML directly from the HTML inspector in the browser. Sep 24, 2021 at 13:22

2 Answers 2

1

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"

0

Class name do not have support for spaces, remove spaces and put . to make it css selector :

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

also try to put some wait before this to make it more consistent.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.