# Target Assertions

## target.assertAttribute

Asserts that the specified [attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes) of a target satisfies the given constraint

![](/files/-LhZhyLGXpIsxBFSGjMc)

## target.assertProperty

Asserts that the specified [property](https://developer.mozilla.org/en-US/docs/Web/API/Element) of a target satisfies the given constraint

![](/files/-LhZi-i0BR44ImAPonxI)

## target.assertVisible

Asserts that the element is currently visible in the current viewport ([intersecting](https://pptr.dev/#?product=Puppeteer\&version=v1.15.0\&show=api-elementhandleisintersectingviewport), styles `display` is not `none`, `visible` is not `hidden`, `opacity` is not `0`)

![](/files/-LhZi1xO1JvslB09UbNl)

## target.assertHtml

Asserts that the HTML content of the focused element satisfies the given constraint

![](/files/-LhZtdvwZ_xBklQjTx3u)

## target.assertBoundingBox

Asserts that the [bounding box](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect) (size and position) of a target satisfies the given constraint

![](/files/-LhZiCSzQEc9x2kgk3kJ)

## target.assertPosition

Asserts that target's position relative to other given target

![](/files/-LhZiG0O5DwM8cRcp-eM)

## target.assertStyle

Asserts that the [computed style](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) of a target matches the given value

![](/files/-LhZiKbc3gj6fjF-Ynw8)

## target.assertMatchesSelector

Asserts that a target matches a given selector or pseudo-selector

![](/files/-LhZiNp44w_A8uvTQSIq)

## target.assertNodeCount

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

![](/files/-LjpyfhTPeiI6krgboXz)

## target.assertTextCount

Asserts that number of child elements containing a specified text satisfies the given constraint.

![](/files/-LjpywrnQsTUpFSWPMCR)

## target.assertContainsClass

Asserts that the specified class value exists in the [element's class attribute](https://developer.mozilla.org/en-US/docs/Web/API/Element).

![](/files/-LhZiQR2Pl08Yui8r2Fs)

## target.assertScroll

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

![](/files/-LhZiTgawNn4IzCNn5CS)


---

# Agent Instructions: 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:

```
GET https://docs.puppetry.app/master/test-step/target-assertions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
