Skip to main content

Scroll a UI Element or Current Page (ui_element.scroll)

This function is available in versions after 20260507

Declaration

ok, info_or_err = ui_element.scroll(direction [, options ])
ok, info_or_err = ui_element.scroll(selector_or_element, direction [, options ])

Parameters

  • selector_or_element Optional, table. A selector, an element returned by a query, or a coordinate table { x = X, y = Y }.
  • direction String. Supported values: "down", "up", "left", "right", "top", "bottom".
  • options Optional, table. Use point, x, or y to choose the hit point; use steps for the step parameter.

Returns

  • ok Boolean. true on success, nil on failure.
  • info_or_err Table on success, string failure reason on failure.

Description

Without a selector, this API tries to scroll the current page. With a selector, it tries to scroll the scrollable area that contains the target. If you need to scroll several pages, call this API in a Lua loop and check page changes yourself.

Example

local ui_element = require("ui_element")

ui_element.scroll("down", {
point = { x = 200, y = 700 },
})

ui_element.scroll({
text_contains = "List",
}, "up")