September 21, 2011

Page scrolling using Selenium and Java script

September 21, 2011 2
Page scrolling using Selenium and Java script
Here is the post how to scroll page using selenium...Earlier i used FOCUS command as a solution/ work around..but its not that much useful in all cases.


The "selenium.focus" should be used when the element you are looking for gets loaded when the page gets loaded and not when you scroll through the page .


Below is the code for scrolling page using selenium...




 selenium.getEval("window.scrollBy(0,200)");


it will scroll the pahe to 200 pixels..if you want you can increase the pixel size.


0 ---X-axis
200--Y-axis


Hope it will be useful for all...