PHP code example of derekmd / laravel-dusk-firefox

1. Go to this page and download the library: Download derekmd/laravel-dusk-firefox library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

derekmd / laravel-dusk-firefox example snippets


namespace Tests;

use Derekmd\Dusk\Concerns\TogglesHeadlessMode;
use Derekmd\Dusk\Firefox\SupportsFirefox;
use Facebook\WebDriver\Firefox\FirefoxOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Laravel\Dusk\TestCase as BaseTestCase;

abstract class DuskTestCase extends BaseTestCase
{
    // ...

    protected function driver()
    {
        $capabilities = DesiredCapabilities::firefox();

        $capabilities->getCapability(FirefoxOptions::CAPABILITY)
            ->addArguments($this->filterHeadlessArguments([
                '--headless',
                '--window-size=1920,1080',
            ]))
            ->setPreference('devtools.console.stdout.content', true);

        return RemoteWebDriver::create('http://localhost:4444', $capabilities);
    }
}

php artisan dusk

php artisan dusk:firefox-driver

php artisan dusk:firefox-driver v0.19.1

php artisan dusk:install-firefox --with-chrome

php artisan dusk

php artisan dusk:chrome

php artisan dusk:chrome tests/Browser/HomepageTest.php --filter testFooter

php artisan dusk

./vendor/phpunit/phpunit/phpunit tests/DownloadBinaries.php