How to "scroll down" on the page which

3,205 views
Skip to first unread message

Niruuu

unread,
Aug 8, 2011, 2:40:20 AM8/8/11
to Selenium Users
Hi,
On a page which uses "AJAX" functionality, the products get loaded as
and
when user scrolls down on the page and i want to click on a product
which is at
the bottom of the page by scrolling down on the page.
Please let me know what commands to use to "scroll down" on the page
and click
on that product. Please let me know ASAP.

waiting for reply plssssssssssssssssssssss

Thanks in advance
Niru

ben akselrod

unread,
Aug 8, 2011, 9:33:49 PM8/8/11
to Selenium Users
Selenium doesn't care whether the product is on the top or bottom,
driver.findElement...().click() should work even if the page is
scrolled up or down

Harish Kumar

unread,
Aug 9, 2011, 3:19:24 AM8/9/11
to seleniu...@googlegroups.com
yes, ben is telling right. But you can also manually scroll up/down, left/right using 
getEval() function.

selenium.getEval("window.scrollTo(x,y)");

for eg:
if you want to scroll down the page 200 px. then:
selenium.getEval("window.scrollTo(0,200)");

--
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.




--
Thank You

HARISH KUMAR

robbie....@nokia.com

unread,
Aug 9, 2011, 4:31:42 AM8/9/11
to seleniu...@googlegroups.com
I not sure if there is a better solution using the Selenium API, but I have used Javascript to do this in the past using the "executeScript" method on the driver.

waiting for reply plssssssssssssssssssssss

Thanks in advance
Niru

--

robbie....@nokia.com

unread,
Aug 9, 2011, 4:36:31 AM8/9/11
to seleniu...@googlegroups.com
Example using Selenium Webdriver to scroll to the bottom of the page;

((JavascriptExecutor)getDriver()).executeScript("window.scrollTo(0, document.body.scrollHeight);");

Varun Menon

unread,
Aug 9, 2011, 8:23:37 AM8/9/11
to Selenium Users

Dave

unread,
Oct 4, 2013, 8:23:38 PM10/4/13
to seleniu...@googlegroups.com
Not true. Chrome will throw, "WebDriverException: Message: u'unknown error: Element is not clickable at point x,x" As it will lose focus. I agree, it shouldn't. 

krishna pramod

unread,
Feb 28, 2014, 1:20:54 AM2/28/14
to seleniu...@googlegroups.com
Hi ben akselrod, i think you are wrong because selenium Webdriver can able to find the element that is displaying in screen length, i mean if there is the element that is visible only when scroll the screen, selenium can't find that element, we need to write the automation code to move the scroll bar.

Mark Collin

unread,
Feb 28, 2014, 4:29:22 AM2/28/14
to seleniu...@googlegroups.com
Selenium will automatically scroll the screen down to find the element.

If you have very convoluted markup with lots of frames it may get confused, but if your markup looks like that you probably need to simplify it anyway.

DongXiang

unread,
Feb 28, 2014, 4:34:28 AM2/28/14
to seleniu...@googlegroups.com
Selenium  not care the element is on the screen or need to scroll down. but if you mean the element will dynamic added when scroll down, you must simulate scroll down action. 


Date: Thu, 27 Feb 2014 22:20:54 -0800
From: krishnapram...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] Re: How to "scroll down" on the page which
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Ripon Al Wasim

unread,
Feb 28, 2014, 4:45:21 AM2/28/14
to seleniu...@googlegroups.com


--
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.
Reply all
Reply to author
Forward
0 new messages