Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I used "sendkeys(keys.pagedown)" but i need to scroll the Div list with height. like scroll-Top in Java script.
Is there any possibilities to scroll?


My code is:


driver.FindElementByClassName("body").SendKeys(Keys.PageDown);
Posted

1 solution

can you please try below,it will focus where you need to,remeber to customize values according to your need

C#
window.onload = function () {
           SetDetailsFocus();
       }
       function SetDetailsFocus() {
           var divheight = document.getElementById("divSelectedItem");
           var footerheight = document.getElementById("footer");
           var _docHeight = $(document).height();
           var scrollposition = _docHeight - (divheight.clientHeight + footerheight.clientHeight + 100);
           window.scrollTo(0, scrollposition);
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900