Use inject JS activity in a scenario to scroll page

Hi All,

I want help in a scenario where I want to scroll over a webpage using invoke js activity.
To start with I followed the below link

created a similar function with something like “Window.scrollTo(0,5000)” but nothing is happening on the page also no error is coming. Can any one please help.

Thanks

Hello @Dhruvi_Arumugam

Is it mandatory to use JS to scroll? Else you can use the Mouse scroll activity to achieve this.

if you just want to scroll all the way to the bottom use this @Dhruvi_Arumugam

function(e) {
window.scrollTo(0, document.body.scrollHeight);
}

you can manually test it by pressing f12 in your browser → console and using the above function
image

Hi,

Can you try to use it with setTimeout as the following?

"function(e,v){
    setTimeout(function() {
       window.scrollTo(0,5000);
    },0);
}"

Regards,

1 Like