iFrame - scrollbar accessible via selenium?

1,802 views
Skip to first unread message

Vinothkumar Velusamy

unread,
May 14, 2014, 7:22:52 PM5/14/14
to seleniu...@googlegroups.com
Hi Team,

In my application , there is an iFrame which have some list of items but only first 10 items will be loaded and visible to user at first shot. Upon user scrolls the scrollbar, the next 10 items will be loaded in the scroll pane. I need to click on 11th item which can be loaded only when i scroll down. but I am not able to scroll down using iFrame - scrollbar as this is not identifiable using selenium web driver. I know in general , scroll bars are not identifiable using selenium web driver, but is there any alternative that we can do using selenium web driver. Right now I am using Robot class which will scroll the mouse button which in turns scrolls the scrollbar in iFrame and the 11th element gets loaded.

Appreciate your response for my request in advance !!!

Thank you,
Vinothkumar Velusamy

Phanindra Chowdary Chunduri

unread,
May 15, 2014, 12:24:12 AM5/15/14
to seleniu...@googlegroups.com
Hi,

Javascript approach to scroll:

((JavascriptExecutor) WebDriverManager.getWebDriver()).executeScript("window.scrollTo(100,250);"); // Scrolling window using Javascript.

Approach which we follow for our app:

When we have similar situation we get the 10th result div and click on it. Click action will do scroll into view that element. So from bottom of page it will come up, so next results will be loaded. (This may not work for all apps but works for us).

Senthil Kumar

unread,
May 15, 2014, 1:05:14 AM5/15/14
to seleniu...@googlegroups.com
Hey Vinoth,
Hope Java Robot class can solve your issue with scrolling.
Robot robot= new Robot(); 
robot.setAutoDelay(100);
System.out.println("++"); 
robot.mouseWheel(25); 
robot.mouseWheel(-25);

On Thursday, May 15, 2014 4:52:52 AM UTC+5:30, Vinothkumar Velusamy wrote:

Vinothkumar Velusamy

unread,
May 15, 2014, 10:24:35 AM5/15/14
to seleniu...@googlegroups.com
Hi Senthil,

Thanks for your reply , actually I have done using Robot only but would like to know any other options available from selenium side.

Thank you
Vinothkumar Velusamy
Message has been deleted

Lan Ta Bao

unread,
Jun 3, 2014, 5:34:02 AM6/3/14
to seleniu...@googlegroups.com
You need switch to the Iframe first, take a look in  : Selenium Swith Command

Then you will able to use Action of Selenium to handle the scrollbars : Take a look in this example : Selenium Tutorial Scrollbars

Hope this can help you
Reply all
Reply to author
Forward
0 new messages