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
I have an example:
1-) attach the browser where the script is going to run
[image]
2-)use activity Inject Js Script and write the JS code within quotes:
“function(e){
document.querySelectorAll(‘input’)[0].value = ‘Weather medellin’;
document.querySelector(‘button[aria-label='Buscar con Google']’).click();
return ‘Script Exitoso’
}”
[image]
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.
jack.chan
(Jack Chan)
June 10, 2022, 5:27am
3
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
Yoichi
(Yoichi)
June 10, 2022, 5:29am
4
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