---
title: "parseHTML( src ) | Grafana k6 documentation"
description: "Parse an HTML string and populate a Selection object."
---

# parseHTML( src )

Parse an HTML string and populate a [Selection](/docs/k6/latest/javascript-api/k6-html/selection/) object.

Expand table

| Parameter | Type   | Description  |
|-----------|--------|--------------|
| src       | string | HTML source. |

### 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 { parseHTML } from 'k6/html';
import http from 'k6/http';

export default function () {
  const res = http.get('https://k6.io');
  const doc = parseHTML(res.body); // equivalent to res.html()
  const pageTitle = doc.find('head title').text();
  const langAttr = doc.find('html').attr('lang');
}
```
