press(key, [options])
Warning
Use
locator.press(key[, options])
instead.
Press a single key on the keyboard or a combination of keys.
Returns
Example
import { browser } from 'k6/browser';
export const options = {
scenarios: {
browser: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
await page.goto('https://test.k6.io/browser.php');
const text = await page.$('#text1');
await text.press('i');
await text.press('ArrowLeft');
await text.press('h');
await page.close();
}