Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Next Page not opening using Selenium

<li class="item pages-item-next">
<a class="action  next" href="https://oup.com.pk/academic-generalbooks.html?p=2" title="Next">
 <span class="label">Page</span>
  <span>Next</span>
 </a>
 </li>

Above is the code of HTML, i’m trying to click next page using selenium in python, but it is not clicking. my code is down here:

x=browser.find_element(By.CLASS_NAME,’action.next’)

x.click()

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

why i’m getting this error:
ElementNotInteractableException

Any help would be appreciated.

>Solution :

Root cause:

By.CLASS_NAME,'action.next' – This is incorrect.

By.CSS_SELECTOR, '.action.next' This is correct

Try this using XPATH locator:

x = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(@class,'action  next')]")))
x.click()

Imports:

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading