Element is hidded by the top bar


I’ve used “Scroll to element”, Katalon makes the scroll but the object stays right behind the top bar of the website, is there any option to make katalon scroll just until the beginning of the top bar and keep the object “visible”?

thanks in advance

Perhaps you can use:

WebUI.scrollToPosition(100, 0)

Note: the 0 is your Y coordinate (i.e. the up and down).

As for keeping the element “visible”, that may be something else.

I have thought about that option but, if there’s something more added to the page then the coordinate would lead me to other object, right?

Not sure what you mean by “lead me to other object” since there is no object in the statement, only coordinate positions. You perhaps don’t want the top, then you can set it at:
WebUI.scrollToPosition(100, 10)

Anyways, try either of the statements and see if it works.

Sorry, I meant, If I put the coordinate (100,10), so I can see the object. If the page changes the objects, in the coordinate (100,10) we’ll see other things, right?

Ah. Then maybe we should use the element’s own position on the page to scroll to. As an example:

myItem = WebUI.findWebElement(findTestObject('yourElement'))

WebUI.scrollToPosition(100, myItem.getLocation().getY())


It helped and solved my problem! Thank you so much!

What is the hard-coded delay() for?