0

In Python, using Selenium, I tried to get some info about NAE members by crawler automatically. So I start from this page.

I located the element of next page by xpath "//*[@title=\"Next Page\" and @class=\"next_page\"]", which I am sure is correct.

Then I found out that I can't do 'click' on this element, which means I can't get the next page.

Right now I have figured out that it makes sense to use:

element.execute_script 

to execute javascript in href of the element, and get the next page.

So, my question is, why I get a not clickable exception, and why I can do execute_script this way?

Anyway, a lot of thanks for whoever read this question, and I am much appreciated all your comments.

Thank you.

Ratmir Asanov
  • 6,237
  • 5
  • 26
  • 40
leonbear
  • 104
  • 11

1 Answers1

0
  1. Try to use explicit wait for that:

element = ui.WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".next_page")))

  1. Before clicking on the Next Page scroll to this element:

driver.execute_script("arguments[0].scrollIntoView(true);", element)

  1. Then click on this button:

element.click()

Hope it helps you!

Ratmir Asanov
  • 6,237
  • 5
  • 26
  • 40