Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I recently upgraded my chrome version to 60 and chromedriver to version 2.31. Post that I have started getting the following exception when I try to do a maximize of the browser window.

driver.driver.manage().window().maximize()

org.openqa.selenium.WebDriverException: unknown error: failed to change window state to maximized, current state is 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: The server did not provide any 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 my 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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

Since you're running tests in a headless mode, there is no active browser window available. As such your

   driver.driver.manage().window().maximize()

would always fail in such situations because the driver doesn't know which window to maximize since there aren't any available.

You can either follow what @DebanjanB has mentioned or you can start the headless browser with a specific screen size like 1440x900 etc, doing something like this

 driver.manage().window().setSize(new Dimension(1440, 900));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...