Skip to main content
Repeatedly click a button until no new content appears or max clicks reached. This function is useful for “Load More” buttons or paginated content where you need to keep clicking until all content is loaded. It provides several stopping conditions:
  • Button becomes invisible/disabled
  • Maximum number of clicks reached
  • No change detected in container content (when container_locator is provided)

Examples

Arguments

Page
required
Playwright Page object
Locator
required
Locator for the button to click repeatedly
Callable[[], None]
Optional callback invoked after each click. Defaults to lambda: None.
Locator
Optional content container to detect changes. Defaults to None.
int
Maximum number of times to click the button. Defaults to 50.
float
Delay after each click (in seconds). Defaults to 0.5.
int
Minimum change in content size to continue clicking. Defaults to 0.

Returns: None

Function completes when clicking is exhausted