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

Working with HTML forms

A common use case when testing web sites is to fill in and submit forms.

In many cases using the Selection API (jQuery API clone) to interact with HTML data is enough, but for some use cases, like with forms, we can make things easier and the code more compact by wrapping the Selection API plus some additional logic to get a higher-level API.

That's what we've done with the Response.submitForm( [params] ) API.

import http from "k6/http";

export default function() {
    // Request page containing a form
    let res = http.get("https://httpbin.org/forms/post");
    // Now, submit form setting/overriding some fields of the form
    res = res.submitForm({ fields: { custname: "test", extradata: "test2" }, submitSelector: "mySubmit" })

Updated 2 years ago

Working with HTML forms

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.