# Dropdown Action

Source: https://docs.scrappey.com/docs/dropdown-action

> Select an option from a dropdown menu on a webpage by targeting it with a CSS selector and specifying the desired option via index or value.

## Command

`"dropdown"`

## Parameters

| Parameter         | Type    | Required | Description                                                         |
| ----------------- | ------- | -------- | ------------------------------------------------------------------- |
| `cssSelector`     | string  | Yes      | CSS selector or XPath for the dropdown element.                     |
| `index`           | number  | No       | Index of the option to select (starting from 0). Either `index` or `value` must be provided. |
| `value`           | string  | No       | Value of the option to select (matches HTML `value` attribute). Either `index` or `value` must be provided. |
| `wait`            | number  | No       | Time in seconds to wait after the action.                           |
| `waitForSelector` | string  | No       | Wait for a specific element after selection.                        |
| `timeout`         | number  | No       | Max time in milliseconds to wait for the dropdown (default: 60000). |
| `ignoreErrors`    | boolean | No       | Continue even if the action fails.                                  |

## Example

```bash
curl -X POST "https://publisher.scrappey.com/api/v1?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "request.get",
    "url": "https://example.com",
    "browserActions": [
      {
        "type": "dropdown",
        "cssSelector": "#exampleDropdown",
        "index": 1,
        "wait": 2
      },
      {
        "type": "dropdown",
        "cssSelector": "#anotherDropdown",
        "value": "option2",
        "waitForSelector": "#resultElement"
      }
    ]
  }'
```

## Notes

Either `index` or `value` must be provided. Do not use both at the same time.

## Related concepts

Go deeper in the [Scrappey knowledge base](https://scrappey.com/qa):

- [Playwright](https://scrappey.com/qa/web-scraping-apis/what-is-playwright) — the automation engine behind browser actions
- [Dynamic content scraping](https://scrappey.com/qa/web-automation/dynamic-content-scraping) — working with interactive pages
