john-doherty / selenium-cucumber-js

Browser automation framework written in pure JavaScript using official selenium-webdriver and cucumber-js
ISC License
120 stars 89 forks source link

(Jenkins / Xvfb) Failed to change window state to maximized #70

Open thymian-garden opened 6 years ago

thymian-garden commented 6 years ago

Hi, thanks for this project, it is very helpful! However, I have this problem every time I run my tests on my Jenkins instance: WebDriverError: unknown error: failed to change window state to maximized, current state is normal (Session info: chrome=67.0.3396.62) (Driver info: chromedriver=2.38.552522 (...),platform=Linux 4.15.0 I am using Xvfb with the following command: Xvfb :0 -ac -screen 0 1600x1200x24 The problem seems kind of similar to this: https://bugs.chromium.org/p/chromedriver/issues/detail?id=1901 So I tried out what happens when I delete the line driver.manage().window().maximize();... and it really makes the tests run successfully. Would it make sense to have a parameter that allows passing a window size, and if set, the driver setup code would use driver.manage().window().setSize(windowSize); instead of driver.manage().window().maximize();? Best regards!

edit/P.S.: My current workaround is running the following command before each execution: sed -i s/maximize\(\)/setSize\(1500,1100\)/g ./node_modules/selenium-cucumber-js/runtime/chromeDriver.js (but this is obviously a very dirty hack and I'd like to get rid of it)