Laravel - Browser Tests - Shorthand Selectors

The elements method within page classes allows you to define quick, easy-to-remember shortcuts for any CSS selector on your page. For example, let's define a shortcut for the "email" input field of the application's login page:

    
    /**
     * Get the element shortcuts for the page.
     *
     * @return array
     */
    public function elements()
    {
        return [
            '@email' => 'input[name=email]',
        ];
    }
	

Once the shortcut has been defined, you may use the shorthand selector anywhere you would typically use a full CSS selector:

    
    $browser->type('@email', '[email protected]');