Scroll DIV element in watir-webdriver

1,920 views
Skip to first unread message

the_zonker

unread,
Sep 27, 2011, 11:10:24 AM9/27/11
to Watir General
Hi guys,

My SUT has a modal popup with dynamically loaded content. When user
scrolls it down new records appear. DIV element of modal popup, which
contains all records, has its own scroll bar.

So my task is to scroll down DIV to the bottom, wait until all records
are loaded and get them all.
At present moment I cannot scroll down DIV.

I tried to iteratively focus on records to get scrolling in DIV, but
scrolling didn't happen and thereby no any records are loaded.

Does watir-webdriver has native methods to scroll inside the element
(not in browser window or frame)?
I know that there are some solutions which use tricky Javascript but
I'm trying to avoid it.

I appreciate any help.

Regards, Vadim



orde

unread,
Sep 27, 2011, 12:54:39 PM9/27/11
to Watir General
This works in watir 1.9.x:

@browser.div(:id, foo).document.scrollintoview

Hope it helps.

orde

Jari Bakken

unread,
Sep 27, 2011, 3:35:39 PM9/27/11
to watir-...@googlegroups.com
On Tue, Sep 27, 2011 at 5:10 PM, the_zonker <the.z...@gmail.com> wrote:

Does watir-webdriver has native methods to scroll inside the element
(not in browser window or frame)?

Try this (accessing the underlying WebDriver API):

  element.wd.location_once_scrolled_into_view 

the_zonker

unread,
Sep 29, 2011, 8:55:09 AM9/29/11
to Watir General
Thanks, Jari.

It works.

On Sep 27, 10:35 pm, Jari Bakken <jari.bak...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages