1

I'm trying to scroll through a PDF with Selenium but It doesn't appear to be working.

The code I'm working with is a little in depth but here's the crucial bits.

    driver = webdriver.Firefox()

    driver.maximize_window()
    driver.get("http://scop-qb.org/wp-content/uploads/SCOP-B-Round-2.pdf")


    for rectangle in rectangles:
        if not previous is None:
            driver.execute_script("window.scrollTo({0}, {1})".format(rectangle[0], rectangle[1]))

I've been searching for a solution all night, if anyone could help that'd be great.

1 Answer 1

1

An alternative would be to chain a bunch of down-arrow keys or spacebars together:

driver.get("http://scop-qb.org/wp-content/uploads/SCOP-B-Round-2.pdf")
time.sleep(1)
actions = ActionChains(driver)
for _ in range(3): # Adjust for how far down the page you want
    actions.send_keys(Keys.ARROW_DOWN).perform()
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks I'll try this out

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.