Scoll down and scroll up in Webdriver.

2,683 views
Skip to first unread message

Ajeesh.V.L

unread,
Jan 11, 2012, 8:03:40 AM1/11/12
to Selenium Users
Can any one please help me out to automate scroll down functionality
with Webdriver?

In my test system I have a functionality in which news feeds are
getting displayed once we scroll down the mouse (Like facebook news
feeds rendering).

Thanks in Advance,
Ajeesh.

KenCK

unread,
Jan 11, 2012, 11:26:19 AM1/11/12
to Selenium Users
AFAIK there is no scroll functionality. Best bet is to set focus on an
element that will trigger the event.

-Ken

Lukus

unread,
Jan 11, 2012, 1:10:16 PM1/11/12
to Selenium Users
I don't beliebe there's a built-in method for scrolling the page. I
have consistent results with using javascript:

window.scrollTo(x,y);

then to get my scroll position, for exampe vertically:

if (window.pageYOffset) return window.pageYOffset;else if
(window.document.documentElement.scrollTop)return
window.document.documentElement.scrollTop;else return
window.document.body.scrollTop;

bis

unread,
Jan 11, 2012, 2:23:58 PM1/11/12
to seleniu...@googlegroups.com
I guess you could pick an element that is at the bottom of the page and an element that is at the top If i am not mistaken it scrolls them into view to interact with them by default?


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Dave Whalen

unread,
Jan 11, 2012, 2:36:52 PM1/11/12
to Selenium Users
I'm having a similar issue. I need to have Selenium/Web Driver click
a button that is only visible if I scroll down. Without scrolling,
Selenium can seem to see the button and therefore I can't click it.
Since it can't find the button, I get an error. It appears there is a
way to set the focus but I'm not exactly sure how to do that.

Dave Whalen

unread,
Jan 11, 2012, 2:21:09 PM1/11/12
to Selenium Users
Not to sound stupid, but...

How would I set focus?
Reply all
Reply to author
Forward
0 new messages