Skip to content

Update locator.click() to use async/await syntax #1126

@mdcruz

Description

@mdcruz

As part of xk6-browser v0.9.0 release, locator.click() now supports async/await syntax so this needs to be reflected on our docs too. See below info:

xk6-browser#790 Convert locator.click to async to have feature parity with page.click and elementHandle.click. Users must remember to work with promise.All and page.waitForNavigation() when a click action results in navigation.

A `location.click` action that doesn't result in navigation can be used like so:
```javascript
const tails = page.locator("input[value='Bet on tails!']");
await tails.click(),
```

A `location.click` action that does result in a navigation can be used like so:
```javascript
const tails = page.locator("input[value='Bet on tails!']");
await Promise.all([
  page.waitForNavigation(),
  tails.click(),
]);
```

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions