0

I'm trying to scrape the contents of the table in this site: breachlevelindex. So far I succesfully get the contents of the first 20 rows on the table using the following:

    url = 'http://www.breachlevelindex.com/index.html?utm_source=bli-pr-20140217&utm_medium=press-release&utm_campaign=breach-level-index#!breach-database'
    driver = webdriver.Firefox()
    driver.get(url)
    driver.set_window_position(0, 0)
    driver.set_window_size(100000, 200000)
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
    time.sleep(5) # wait to load

at this point I can scrape the table content, but how to programatically press the next button and reload the contents of page ?

thanks !

2 Answers 2

4

You locate the next button using CSS and then click it, like so :

driver.find_element_by_css_selector(".sprite.next-page.clickable").click()

or using javascript like so :

driver.execute_script("document.querySelector('.sprite.next-page.clickable').click()")
Sign up to request clarification or add additional context in comments.

Comments

1

I think this will work for you:

driver.find_element_by_css_selector("span.next-page").click()

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.