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.

1
  • Thank you @Andersson , I missed that post, it's true a same story. Commented Mar 5, 2018 at 10:27

1 Answer 1

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!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.