Skip to content

Commit 1342ef6

Browse files
committed
Add some more documentation
1 parent 121c99a commit 1342ef6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/guide/browser/interactivity-api.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,33 @@ test('clicks on an element', async () => {
5959
await userEvent.click(logo)
6060
// or you can access it directly on the locator
6161
await logo.click()
62+
63+
// With WebdriverIO, this uses either ElementClick (with no arguments) or
64+
// actions (with arguments). Use an empty object to force the use of actions.
65+
await logo.click({})
6266
})
6367
```
6468

69+
### Clicking with a modifier
70+
71+
With either WebdriverIO or Playwright:
72+
73+
```ts
74+
await userEvent.keyboard('{Shift>}')
75+
// By using an empty object as the option, this opts in to using a chain of actions
76+
// instead of an ElementClick in webdriver.
77+
// Firefox has a bug that makes this necessary.
78+
// Follow https://bugzilla.mozilla.org/show_bug.cgi?id=1456642 to know when this
79+
// will be fixed.
80+
await userEvent.click(element, {})
81+
await userEvent.keyboard('{/Shift}')
82+
```
83+
84+
With Playwright:
85+
```ts
86+
await userEvent.click(element, { modifiers: ['Shift'] })
87+
```
88+
6589
References:
6690

6791
- [Playwright `locator.click` API](https://playwright.dev/docs/api/class-locator#locator-click)

0 commit comments

Comments
 (0)