---
title: "Response.html() | Grafana k6 documentation"
description: "Parses response as HTML and populate a Selection."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Response.html()

Parses response as HTML and populate a [Selection](/docs/k6/latest/javascript-api/k6-html/selection/) object.

### Returns

Expand table

| Type                                                           | Description        |
|----------------------------------------------------------------|--------------------|
| [Selection](/docs/k6/latest/javascript-api/k6-html/selection/) | A Selection object |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import http from 'k6/http';

export default function () {
  const res = http.get('https://stackoverflow.com');

  const doc = res.html();
  doc
    .find('link')
    .toArray()
    .forEach(function (item) {
      console.log(item.attr('href'));
    });
}
```
