# Target Commands

## target.type

Focuses the element, and then sends keyboard events for each character in the text

![target.type](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqULfkW6T4ZMiMq5B%2Ftarget.type.png?alt=media\&token=b4b6fbfe-5b4b-4ed4-9dac-e3a20df8160f)

## target.select

Sets value on select element

![target.select](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqbQ_-THr617_wMfj%2Ftarget.select.png?alt=media\&token=b0703190-c562-4a9a-89c8-236c785fdc54)

## target.focus

Focuses the element

![ target.focus](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqgXi4qrtTsmtioSW%2Ftarget.focus.png?alt=media\&token=6178d244-3066-40f9-8b5d-27488a4ba62e)

## target.click

Emulates mouse click on the element

![target.click](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqlifvlvwSpFcTaNi%2Ftarget.click.png?alt=media\&token=b813922f-53a5-4fc3-9fbe-239594d92166)

## target.reset

Resets the input or form element

![target.reset](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqpm_wHAgF5sCzLST%2Ftarget.reset.png?alt=media\&token=7bddaf70-8a7b-47ed-aebb-ceaffee69c20)

## target.upload

Sets the value of a file input. Note that the target element must be INPUT of FILE type. It is also recommended to emulate click on the target (or clickable element calling the file browser) before going with this command

![target.upload](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuClppML3RjM-dGOyEk%2F-LuCqw0Ig7Aa9oajt8V7%2Ftarget.upload.png?alt=media\&token=91be8ed0-0436-4d5b-b731-705f42fed025)

{% hint style="info" %}
Since ver. 3.2.6 file path supports template expressions. So you can use e.g. environment variables to build the path.
{% endhint %}

Alternatively you can specify with in advanced options file size and name and it will be generated and attached to the file input element.

![target.upload advanced options](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LvAc0LsQwoEV2Jt-lOj%2F-LvBO_5_1vGW1IRz6SfZ%2Ftaget.upload-update.png?alt=media\&token=9933f10a-9cef-4d43-81bb-c8c61da80f49)

## target.tap

Taps the element

![target.tap](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD2L_2vYmVCRfPb9VP%2Ftarget.tap.png?alt=media\&token=07229ff0-a056-4202-83c5-4d6be9a2960b)

## target.scroll

Sets the number of pixels that an element's content is scrolled horizontally/vertically.

![target.scroll](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD2TE4SvvTOch1uxuY%2Ftarget.scroll.png?alt=media\&token=b6c92ffc-fa86-46ac-8c51-561845e95b47)

## target.scrollIntoView

Scrolls element into view.

![target.scrollIntoView](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD2jcQRivUwkzDWBvk%2Ftarget.scrollIntoView.png?alt=media\&token=f8ce25a4-77bb-416a-b4b3-2d823b4a952f)

## target.hover

Scrolls element into view if needed, and then hovers over the center of the element

![target.hover](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD2pgaVIJOkKTc5jZp%2Ftarget.hover.png?alt=media\&token=b0c25a53-736b-44de-ab7f-73c74716a82e)

## target.checkBox

Toggles checkbox/radio state

![target.checkBox](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD2unq2BuZH9gFKe9L%2Ftarget.checkbox.png?alt=media\&token=9afa26c1-bc81-4c8a-920a-f4da50ca69ad)

## target.toggleClass

Toggles the specified class value (adds or removes)

![target.toggleClass](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD3-bgUJdxCmvVglLc%2Ftarget.toggleClass.png?alt=media\&token=b3795446-6371-43c0-b49f-c8c0510426a9)

## target.setAttribute

Sets the value of an [attribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) on a target

![target.setAttribute](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD36TT02r758jt5Xo7%2Ftarget.setAttribute.png?alt=media\&token=ffb4383f-2b2a-4978-8732-f023fcac9fa5)

## target.screenshot

Takes a screenshot of the target element.

![target.screenshot](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD3HgWR9nSPH5pLm0S%2Ftarget.screenshot.png?alt=media\&token=0298c2ae-0b6e-4ea0-9d8b-b92967ec340c)

![Selecting targets to highlight on the screenshot](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD3O5Ile6qjzZjHlnP%2Ftarget.screenshot2.png?alt=media\&token=1e21a652-360d-4bcf-a151-2683e1a972d3)

## target.waitForTarget

Waits for an element matching a provided target to appear in page.

![target.waitForTarget](https://3461068122-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LuD2Ev-6idf_X8YjGye%2F-LuD3h4PLgZoLMFv9zr_%2Ftarget.waitForTarget.png?alt=media\&token=78214d42-9ae7-4e97-993a-adc468ab852a)


---

# 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/test-step/target-commands.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.
