Dusk: Default resolution

Created on 15 Jun 2017  路  5Comments  路  Source: laravel/dusk

How to set default resolution?
Now I make like this
$this->browse(function (Browser $browser){ $browser->resize(1440, 900); }
But better if I can setup this once. Thank you

Most helpful comment

Good news, I have found better multi-browser solution:
protected function driver() { $driver = RemoteWebDriver::create( env('SELENIUM_HUB', 'http://localhost:4444/wd/hub'), DesiredCapabilities::chrome() ); $size = new WebDriverDimension(1440,900); $driver->manage()->window()->setSize($size); return $driver; }

All 5 comments

May be I have found a solution:

protected function driver()
    {
        $options = new ChromeOptions();
        $options->addArguments([
            '--window-size=1440,900',
            '--disable-web-security'
        ]);
        return RemoteWebDriver::create(
            env('SELENIUM_HUB', 'http://localhost:4444/wd/hub'),
            DesiredCapabilities::chrome()->setCapability(ChromeOptions::CAPABILITY, $options)
        );
    }

Hi this is possible using phantomjs ?

Good news, I have found better multi-browser solution:
protected function driver() { $driver = RemoteWebDriver::create( env('SELENIUM_HUB', 'http://localhost:4444/wd/hub'), DesiredCapabilities::chrome() ); $size = new WebDriverDimension(1440,900); $driver->manage()->window()->setSize($size); return $driver; }

@xakzona thanks a lot

if you don't want to go digging, be sure to add

use Facebook\WebDriver\WebDriverDimension;
Was this page helpful?
0 / 5 - 0 ratings

Related issues

fwang-laralabs picture fwang-laralabs  路  6Comments

susanBuck picture susanBuck  路  6Comments

pdbreen picture pdbreen  路  4Comments

muswanto picture muswanto  路  3Comments

subathanikaikumaran picture subathanikaikumaran  路  3Comments