# Target Commands

## target.type

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

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhVKPIqacZZAr0eeHKs%2F-LhVKb_cTMZecAmJQk7O%2Ftarget.type.png?alt=media\&token=7577d06a-41b9-416d-9614-cf66010b4d1a)

## target.select

Sets value on select element

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhVKPIqacZZAr0eeHKs%2F-LhVKemidM0zF-zWjUax%2Ftarget.select.png?alt=media\&token=0f53ace2-915e-423c-a27e-648532d5d63c)

## target.focus

Focuses the element

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhVKPIqacZZAr0eeHKs%2F-LhVKhPUluU0fzRSdoel%2Ftarget.focus.png?alt=media\&token=a3a3044a-a5df-4880-ab22-25d675854848)

## target.click

Emulates mouse click on the element

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhYVOcYb0WIdnn8K4%2Ftarget.click.png?alt=media\&token=85b71a2c-a372-41fa-8edf-526e348c2eb7)

## target.reset

Resets the input or form element

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZh_vJgkVoqnkkLXTk%2Ftarget.reset.png?alt=media\&token=23db4803-e984-48b4-a496-f13684260a45)

## 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

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhcYE7FFOmyMYwKKN%2Ftarget.upload.png?alt=media\&token=c1874d42-c367-40e9-bd30-58edf5379230)

## target.tap

Taps the element

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhf0Av-UMZkBJyUvX%2Ftarget.tap.png?alt=media\&token=ba39306c-7c4a-4559-af22-4318decbdec0)

## target.scroll

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

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhgsMospYE7AUNrdG%2Ftarget.scroll.png?alt=media\&token=ed68a6de-f8a5-492d-baa2-7916f45e3797)

## target.hover

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

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhjGXL_ghOK9rzq-j%2Ftarget.hover.png?alt=media\&token=f8705c91-ab27-44b5-8e4b-4eb0e3949441)

## target.checkBox

Toggles checkbox/radio state

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhlV-nLPkw_75P885%2Ftarget.checkbox.png?alt=media\&token=4de85e19-0278-4add-89a6-1800fe46091d)

## target.toggleClass

Toggles the specified class value (adds or removes)

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhps1m3bXm_h3-riL%2Ftarget.toggleClass.png?alt=media\&token=de3f920e-d514-4797-bba1-b20565231df3)

## target.setAttribute

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

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LhZhU2MWfEjMN3ZJsgN%2F-LhZhtVeIo0bKfbCGRDi%2Ftarget.setAttribute.png?alt=media\&token=ecca5fa1-9375-4b4f-9330-4beb55071d19)

## target.screenshot

Takes a screenshot of the target element.

![](https://2843146877-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdyKJ-zzeS2hB7DF04J%2F-LjpzX_KsB7K59aQoyRv%2F-Ljpzg0dm7ma2P44C1KA%2Ftarget-screenshot.png?alt=media\&token=8dc02ce0-60ba-4922-973b-a808b3430027)
