Reputation: 19
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
Upvotes: 1
Views: 1596
Reputation: 41
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.
Upvotes: 1