Protractor: WebDriverError: unknown error: failed to change window state to maximized, current state is normal

Created on 31 Oct 2018  路  14Comments  路  Source: angular/protractor

Hi Team,

I have been using the maximize command for a long time ago but right now I'm facing this bug.

// My commands
browser.driver.manage().window().setSize(2440, 900);
browser.driver.manage().window().maximize(); // if I comment this line, it work fine!

Node: 6.9.1
protractor: 5.4.1
chrome=70.0.3538.77
chromedriver=2.40.565386
platform=Mac OS X 10.13.6 x86_64

image

This image is from a coworker:
image

Thanks,

Most helpful comment

This issue is fixed in ChromeDriver 2.44

Fixed WindowMaximize on Mac

http://chromedriver.chromium.org/downloads

All 14 comments

i am getting same error. can anyone solve it

It's an issue of specific chrome version, just use setSize()

Hi @CrispusDH at least for me, my tests are running in a lot screen sizes so I cannot put each size using setSize() for all of them. I need to fix that or find another way to do the same.

Hi, @djom20 ! Please provide your config file and tests example.

@IgorSasovets, My config file is a little different but working as the normal config.

'use strict';

exports.set = function (params) {
    return {
        directConnect: true,
        ignoreUncaughtExceptions: true,
        baseUrl: params.baseUrl,
        capabilities: {
            'browserName': 'chrome',
            'name': 'Test',
            'chromeOptions': {
                'args': ['--no-sandbox', '--start-maximized', 'use-fake-ui-for-media-stream'],
                'prefs': {
                    'profile.managed_default_content_settings.notifications': 1
                }
            }
        },
        specs: [
            '**/**.feature'
        ],
        allScriptsTimeout: 50000,
        framework: 'custom',
        frameworkPath: require.resolve('protractor-cucumber-framework'),
        cucumberOpts: {
            require: [
                '*_steps.js',
            ],
            format: 'pretty',
            tags: ['@complete'],
            keepAlive: false,
            'dry-run': false,
            strict: true
        },
        onPrepare: function () {
            browser.driver.manage().window().setSize(2440, 900);
            browser.driver.manage().window().maximize(); // The issue is here
        }
    };
};

I ran it on local machine and all works without errors. Try to remove --start-maximized option and update chromedriver to the latest version.

@IgorSasovets let me test it, also which chromedriver version do you have?

I just updated the chrome driver and removed the --start-maximized option, but the bug still happening.

image

I used chromedriver 2.43, node 8.11.3, and the same chrome version. Also, I installed node 6.9.1 and ran under mentioned version, tested it on MacOS 10.12 and Windows 7. BTW, what is your working machine screen resolution?

@IgorSasovets my resolution is:

image

I just update my node version to test it, and I get the same bug.

I am getting the same issue with the chrome version "70.0.3538.77" but if I downgrade it to version "69.0.3497.92", it is working fine.

Error details are -
_WebDriverError: unknown error: failed to change window state to maximized, current state is normal
(Session info: chrome=70.0.3538.77)
(Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.12.6 x86_64)__

My configuration details are as below
chromedriver - 2.43.600229
node - v8.1.3
macos Sierra - 10.12.6

@djom20 , I guess that there might be problems with MacOS version support. Did you try the configuration on another OS?

@IgorSasovets , I don't have another OS right now. Let me try to downgrade it to version to know if work fine.

This issue is fixed in ChromeDriver 2.44

Fixed WindowMaximize on Mac

http://chromedriver.chromium.org/downloads

Was this page helpful?
0 / 5 - 0 ratings