Maximize OR resize browser window in Behat/Mink (ways how to get full screen in Behat/Mink). In this article I would like to describe ways how easily resize or maximize window using Behat/Mink.
1) First way to resize window in Behat/Mink is using @BeforeStep anotation.
/** * @BeforeStep */ public function beforeStep() { $this->getSession()->resizeWindow(1440, 900, 'current'); }
2) Second way is resize window in a behat step definitions.
And I set browser window size to "1280" x "600" Code: /** * @Given /^I set browser window size to "([^"]*)" x "([^"]*)"$/ */ public function iSetBrowserWindowSizeToX($width, $height) { $this->getSession()->resizeWindow((int)$width, (int)$height, 'current'); }
3) Here is the simple code how to maximize window in @BeforeStep.
/** * @BeforeStep */ public function beforeStep() { $this->getSession()->getDriver()->maximizeWindow(); }
or in behat step definitions:
And I maximize browser window size Code: /** * @Given /^I maximize browser window size$/ */ public function iSetBrowserWindowSizeToX($width, $height) { $this->getSession()->resizeWindow((int)$width, (int)$height, 'current'); }