ScrolltoPosition() doesnt work multiple times in a webpage

Hi, Im testing a webpage. It has more elements and needs scroll around the page to choose the elements. So i need to scroll up and down multiple times
Im using scrollToPosition(999999,999999) to scroll to the bottom and scrollToPosition(0,0) to scroll up
This perfectly works fine for the first time

When im using the same script again to scroll down/up, it s not working.
It retains in the middle of the page and it fails.

Please help me out


not faced any issues


for (int i = 0; i < 5; i++){
WebUI.scrollToPosition(999999, 999999)
WebUI.scrollToPosition(0, 0)

Hi Timo,

But this looping will not work for me. for each scroll, i need to choose different elements.


WebUI.scrollToPosition(999456, 999456)‘Page_Create Form - datahub/a_Single Space’)) ## it will auto scroll up after choosing this element ##

WebUI.waitForElementVisible(findTestObject(‘Page_Create Form - datahub/a_Add new field’), 30)‘Page_Create Form - datahub/a_Add new field’))


WebUI.scrollToPosition(998989, 998989) ## Here its not scrolling down to choose another element ##‘Page_Create Form - datahub/a_Section Title’))

Can you pls help me out


why you have to use scroll to locate elements?

Hello Timo,

My product webpage will be like in the attachment
It will have set of 30 elements on left side and user can choose based on the their wish .the selected ones will display on right one by one.
At the first sight, all the 30 elements couldnt be visible. just u can see 25 elements. we need to scroll down to choose the last 5 elements.
Also, after the user choosen nearly 3 elements, we need to scroll up and down to choose all the selected elements


why selecting element as a locator not do that? should do path))

or first focus element

WebUI.focus(findTestObject(object path)) path))

Yea like @Timo_Kuisma said, you shouldnt need to scroll for anything, It may not be visible to the current screen but its still technically present so it will just scroll for you.

Thanks both of you. i will try and let you know the output


so Focus() followed by click() will autoscroll the page by finding elements by itself?

as you mentioned, its not visible in current screen but its there technically. How can i make it to be click on those elements?

I tried with above focus() followed by click().
Getting below error:
com.kms.katalon.core.exception.StepFailedException: Unable to click on object ‘Object Repository/Page_Create Form - datahub/a_addBulk Answers’
Caused by: org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element is not clickable at point (108, 690). Other element would receive the click:

Kindly help me out


which type you are using elements locator, attribute or xpath?
Is this Windows or Linux or Mac OS?

i recorded using katalon web recorder. So it has attributes and xpath
This is web application for windows

For focus, im not getting any error. but click doesnt happen

So this is what is causing the error - “Other element would receive the click:”

Have a read of this document, i suggest trying all the solutions that is provides for you. Using JS will solve all your problems so i highly recommend getting used to it. It will help you in the future :slight_smile:

Let me know if you get stuck or it doesnt work.

Thanks a lot. I will try with javascript and will let you know

Thanks a ton. Javascript solved my issue. now i can execute successfully