1
browser = webdriver.Firefox()

browser.get('http://www.example.com')

search_items = []

for i in range(0, 20):   
    items = browser.find_element_by_xpath(
        '//*[@id="asrt%s"]/section[2]'
        % str(i))
    driver.items("window.scrollTo(0, Y)")

    print items.text

2 Answers 2

1

If you are looking to scroll to a WebElement you can use:

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

Where element is the variable to a WebElement you have set.

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

Comments

0

you can use

driver.execute_script("window.scrollTo(0, Y)")

1 Comment

my basic need is to move the scroll down 1 by 1 item i captured, because the web site will not display all item at a time. and i need to capture all item from that web site.

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.