python selenium timeout exception does not pass compiling

I have some Selenium WebDRiver code that searches for the "Next" button and if it exists, it clicks it. If not, the script should catch TimeoutException and continue. Code: from selenium.common.exceptions import TimeoutException def clicking_next_page(): btn_next_to_click=WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[@class=’next’]"))) try: btn_next_to_click.click() crawler() except TimeoutException: pass Error: File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\support\wait.py", line 90, in until raise TimeoutException(message, screen, stacktrace)… Read More python selenium timeout exception does not pass compiling