Element.selection()

This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.

Open source

Element.selection()

Retrieve the Selection matching this element.

Mimics $(element).

Returns

TypeDescription
SelectionThe Selection matching this element.

Example

JavaScript
import http from "k6/http";

export default () => {
	let li = http.get("https://test.k6.io").html().find("li");
	li.each(function(_, element) {
		let container = element.selection().closest('ul.header-icons');
		console.log("li.each", container.html())
	});
}