Laravel - Browser Tests - Using The Keyboard

The keys method allows you to provide more complex input sequences to a given element than normally allowed by the type method. For example, you may instruct Dusk to hold modifier keys while entering values. In this example, the shift key will be held while taylor is entered into the element matching the given selector. After taylor is typed, swift will be typed without any modifier keys:

    
    $browser->keys('selector', ['{shift}', 'taylor'], 'swift');
	

Another valuable use case for the keys method is sending a "keyboard shortcut" combination to the primary CSS selector for your application:

    
    $browser->keys('.app', ['{command}', 'j']);
	
All modifier keys such as {command} are wrapped in {} characters, and match the constants defined in the Facebook\WebDriver\WebDriverKeys class, which can be found on GitHub.