How to set default browser window size in Protractor/WebdriverJS

前端 未结 8 1985
广开言路
广开言路 2020-11-27 15:14

For some reason when I run my tests at work the browser is maximized, but when I run them at home it only opens a browser window of about 50% width. This causes some discrep

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 16:08

    Modify your config.js file as per below.

    onPrepare: function () {
        browser.driver.manage().window().setSize(1280, 1024); // Width, height
    },
    capabilities: {
        browserName: 'chrome',
        chromeOptions: {
            args: [ "--start-maximized" ] // To start the browser as maximixed
        }
    },
    

提交回复
热议问题