No results for

Powered byAlgolia
⚠️ This is archived documentation for v0.46. Go to the latest version

isChecked(selector[, options])

warning

Use locator-based locator.isChecked([options]) instead.

Checks to see if the checkbox input type is selected or not.

ParameterTypeDefaultDescription
selector
string''A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
options
objectnull

Returns

TypeDescription
booltrue if the checkbox is selected, else false.

Example

import { browser } from 'k6/experimental/browser';
export const options = {
scenarios: {
browser: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
}
export default async function () {
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
if (!page.isChecked('#checkbox1')) {
page.check("#checkbox1");
}
}