[WebUI] Scroll To Position

This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/webui-scroll-to-position.html

How to know the X and Y position of DOM Structure while using WebUI.scrollToPosition(x, y), can you clarify this one ?

Personally, I don’t think you need worry about the X position as long as you stay inside the browser, so it is really just getting the Y position. I generally just put the X position as 100 and then calculate the Y position, maybe like:

WebElement box = WebUiCommonHelper.findWebElement(findTestObject(...), 30)
"or WebElement box = driver.findElement(By.xpath('id(..."
int xpos = box.getLocation().getX()
int ypos = box.getLocation().getY()

WebUI.scrollToPosition(xpos, ypos)     // WebUI.scrollToPosition(100, ypos)

I want to know the code for go to middle of the webpage in katalon, can you share that, and i also i used above mentioned code, it is not working