k6

A modern load testing tool, using Go and JavaScript

"like unit testing, for performance"

k6 is a modern load testing tool, building on Load Impact's years of experience. It provides a clean, approachable JavaScript scripting API, distributed and cloud execution, and orchestration via a REST API.

Get Started    Guides

parseHTML( src )

Parse an HTML string and populate a Selection object.

Parameter
Type
Description

src

string

HTML source.

Returns:

Type
Description

object

Selection object.

import {parseHTML} from "k6/html";
import http from "k6/http";

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