Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Element.selection()
Retrieve the Selection matching this element.
Mimics $(element)
.
Returns
Type | Description |
---|---|
Selection | The Selection matching this element. |
Example
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())
});
}