Geb Programmer : How to run Geb with PhantomJS Driver in desktop size
If you are developing your Geb programms with Firefox or Chrome driver, they will probably be running in a traditional desktop resolution. You may be puzzled when your tests fail in PhantomJS driver.
After further investigation you will probably realise that the tests are failing because the code you developed will only work when you run the test in desktop resolution. The website you are working against may be using fancy adaptive design tricks with hidden content which may become visible in mobile resolutions and viceversa.
If you execute Geb with PhantomJS driver, by default, it will run in 400x300. You may want to run it in a desktop resolution. Don't dispare. It is easy. You can tell Geb driver to maximize its window.
import geb.Browser .. . . def browser = new Browser(driver: new PhantomJSDriver()) println browser.driver.manage().window().size.height // 300 println browser.driver.manage().window().size.width // 400 browser.driver.manage().window().maximize() println browser.driver.manage().window().size.height // 768 println browser.driver.manage().window().size.width // 1366
My next events:
🗓 May 27 09:00 AWS Dublin - Micronaut and AWS Lambda
🗓 Jul 20 09:00 Workshop Security in the Micronaut Framework
🗓 Sep 20 09:00 JCON Online 2022 - Getting Started with the Micronaut Framework
🗓 Sep 23 09:00 JCON Online 2022 - Micronaut® Framework and Microstream Java-native persistence engine
Jun 2016, 17.