selenium - Not able to maximize Chrome Window in headless mode -
i upgraded chrome version 60 , chromedriver version 2.31. post have started getting following exception when try maximise of browser window.
driver.driver.manage().window().maximize()
org.openqa.selenium.webdriverexception: unknown error: failed change window state maximized, current state normal (session info: chrome=60.0.3112.78) (driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=linux 4.2.0-27-generic x86_64) (warning: server did not provide stacktrace information) command duration or timeout: 108 milliseconds build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09' system info: host: 'bb-blr-prod-stage-stg1-01', ip: '10.3.211.2', os.name: 'linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.7.0_80' session id: c7de7149dd490cc7760d2f4fc49f0325 driver info: org.openqa.selenium.chrome.chromedriver capabilities [{platform=linux, acceptsslcerts=true, javascriptenabled=true, browsername=chrome, chrome={userdatadir=/tmp/.org.chromium.chromium.wabpho, chromedriverversion=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8)}, networkconnectionenabled=false, unexpectedalertbehaviour=, rotatable=false, setwindowrect=true, locationcontextenabled=true, mobileemulationenabled=false, pageloadstrategy=normal, version=60.0.3112.78, takesheapsnapshot=true, cssselectorsenabled=true, databaseenabled=false, handlesalerts=true, browserconnectionenabled=false, webstorageenabled=true, nativeevents=true, hastouchscreen=false, applicationcacheenabled=false, takesscreenshot=true}]
i run tests in headless mode using chromedriver on geb.
- chrome version - 60.0.3112.78
- chromedriver version - 2.31.488763
- os - ubuntu 14.04.4 lts
- selenium version - 2.53.1
- webdriver language bindings
- geb - 0.13.1
since you're running tests in headless mode, there no active
browser window available. such
driver.driver.manage().window().maximize()
would fail in such situations because driver doesn't know window maximise, since there aren't available.
you can either follow @debanjanb has mentioned or can start headless browser specific screen size 1440x900 etc, doing this
driver.manage().window().setsize(new dimension(1440, 900));
Comments
Post a Comment