Browser

Scrolling, Waiting, and Pagination

PageUp, PageDown, PageTop, and PageEnd scroll the document by page increments. ScrollWindowByVertical and ScrollWindowByHorizontal scroll by a specific pixel count. WaitFor pauses the workflow for a fixed time, until a selector is found, or until an element reaches a given state - see Waiting for Elements, State, and Time (WaitFor) for the full set of overloads and examples in every context. Until and While loop the current workflow until a condition is met or a selector is found. WithNextPageButton, WithPages, and WithInfiniteScroll configure automatic pagination when scraping multi-page data.

NOTE

When using While or Until loops, set WhileLoopTimeout (milliseconds) and WhileLoopMaxIterations to prevent infinite loops in production workflows.

Examples

GPAL Fluent: High-level fluent C# API

//WithInfiniteScroll is a property (no parentheses). GPAL scrolls to the bottom of the page and waits for new content to load, repeating until no new elements appear or the match limit is reached.

// Wait for an element to appear

GPAL.Browser

.GoTo("https://example.com")

.WaitFor("#results")

.WithSelector(".result-row")

.GetGrid(out var results);


// Scrape all pages of a paginated table

GPAL.Browser

.GoTo("https://example.com/data")

.WithSelector(".data-row")

.WithAllThatMatch(500)

.WithNextPageButton(".next-page")

.WithPages(10)

.SaveToCSV("all-data.csv");


// Handle infinite scroll

GPAL.Browser

.GoTo("https://example.com/feed")

.WithSelector(".post")

.WithAllThatMatch(1000)

.WithInfiniteScroll

.GetGrid(out var posts);

💬 Ask GPAL