Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions browser-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ pest()->browser()->timeout(10);
[text](#text)
[attribute](#attribute)
[keys](#keys)
[withKeyDown](#withKeyDown)
[type](#type)
[select](#select)
[append](#append)
Expand Down Expand Up @@ -892,6 +893,20 @@ $page->keys('input[name=password]', 'secret');
$page->keys('input[name=password]', ['{Control}', 'a']); // Keyboard shortcuts
```

<a name="withKeyDown"></a>
### withKeyDown

The `withKeyDown` method executes the given callback while a key is held down:

```php
$page->withKeyDown('Shift', function () use ($page): void {
$page->keys('#input', ['KeyA', 'KeyB', 'KeyC']);
}); // writes "ABC"
```

> Note: To respect held keys like Shift, use key codes such as KeyA, KeyB, KeyC.
> 'a' always types a lowercase “a” and 'A' always types an uppercase “A”, regardless of modifiers.

<a name="type"></a>
### type

Expand Down