> For the complete documentation index, see [llms.txt](https://docs.puppetry.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.puppetry.app/test-step/page-assertions.md).

# Page Assertions

## page.assertTitle

Asserts that the page title satisfies the given constraint

![page.assertTitle](/files/-LuCFtNdmvUDiYHFk0K_)

## page.assertUrl

Asserts that the page URL satisfies the given constraint

![page.assertUrl](/files/-LuCG4D2Kkh4HXQg3cB3)

## page.assertContent

Asserts that the page content (HTML) satisfies the given constraint

![page.assertContent](/files/-LuCGJVPz09_bWaxV_0w)

## page.assertNodeCount

Asserts that number of elements matching a specified selector satisfies the given constraint

![page.assertNodeCount](/files/-LuCGPvcuiOAwZA-KGaA)

## page.assertScroll

Asserts that [window scroll](https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll) offset satisfies the given constraint

![page.assertScroll](/files/-LuCGWA_6Tx69qhsPqSJ)

## page.assertVar

Asserts that variable associated with a given name satisfies the given constraint

![page.assertVar](/files/-LuCGbs_2K67E-98Xg2p)

## page.assertScreenshot

Asserts that screenshot of the page matches already approved one

![page.assertScreenshot](/files/-LuCGt6z3UxgnFatvuLB)

![page.assertScreenshot advanced options](/files/-LuCGvrK-P5zqr83LyOj)

## page.assertRest

Makes HTTP/S request and asserts that the response satisfies the given constraint.

{% hint style="info" %}
The method automatically assigns the response text data to template variable `PUPPETRY_LAST_RESPONSE_TEXT`
{% endhint %}

![ page.assertRest](/files/-LvtymRgPCHMhNKYpowt)

## page.assertResponse

Asserts that the HTTP/S response satisfies the given constraint

![page.assertResponse](/files/-LvtyxdlScBTGR6_N61I)

## page.assertConsoleMessage

Asserts there were (no) console messages sent to console to satisfy the given constraint

![page.assertConsoleMessage](/files/-LuCU7aLM7uB1v8mc--f)

## page.assertDialog

Asserts there was called a dialog (alert, beforeunload, confirm or prompt).

![page.assertDialog](/files/-LuCUBG7j6IBYHuLlS2n)

## page.assertPerformanceAssetWeight

Asserts that total weight of assets (JavaScript, CSS, images, media, fonts, XHR) on the page satisfies the given budget.&#x20;

This assertion makes Puppetry to intercept HTTP requests. It compares the given limits to the encoded length of the requests. Note that the request length is considered `0` when request loaded from cache. So it makes sense to place this step next to the very first `page.goto` in the test suite.

![page.assertPerformanceAssetWeight](/files/-LuCHsENqomQr7BK4e0N)

## page.assertPerformanceAssetCount

Asserts that total number of requested assets (JavaScript, CSS, images, media, fonts, XHR) on the page satisfies the given budget.

![page.assertPerformanceAssetCount](/files/-LuCI9wLypFFWlj1OgZC)

## page.assertPerformanceTiming

Asserts a given [resource timing](https://w3c.github.io/perf-timing-primer/#resource-timing) under a provided budget

![page.assertPerformanceTiming](/files/-LuCIOaTiazTrGcMbedz)

## page.assertGaTracking

Asserts a given action was sent to Google Analytics with [analytics.js](https://developers.google.com/analytics/devguides/collection/analyticsjs) or [gtag.js](https://developers.google.com/analytics/devguides/collection/gtagjs). We also assert that sent payloads are valid according to the Google API

![page.assertGaTracking](/files/-LuCI_wv4zJat1WOhk8R)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.puppetry.app/test-step/page-assertions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
