Menu
Open source
Selection.single(selector)
Returns at most one element matching the selector, as a
Selection object. It’s backed by goquery’s Single matcher, which is faster than
find() when you only need the first match.
Returns
Example
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);
const title = doc.single('h1').text();
}