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, oryto choose the hit point; usestepsfor the step parameter.
Returns
- ok
Boolean.
trueon success,nilon 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")