Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.82 KB

File metadata and controls

42 lines (30 loc) · 1.82 KB
title excerpt
isHidden([options])
Browser module: locator.isHidden method

Checks if the element is hidden.

Parameter Type Default Description
options object null
options.timeout number 30000 Maximum time in milliseconds. Pass 0 to disable the timeout. Default is overridden by the setDefaultTimeout option on BrowserContext or Page.

Returns

Type Description
bool true if the element is hidden, else false.

Example

import { chromium } from 'k6/experimental/browser';

export default async function () {
  const browser = chromium.launch();
  const page = browser.newPage();

  await page.goto('https://test.k6.io/browser.php');
  const text = page.locator('#input-text-hidden');
  if (text.isHidden()) {
    console.log('element is hidden');
  }
}