How are webdriver and chromedriver options accessed in Spectron's new Application()?

冷暖自知 提交于 2021-02-10 18:01:51

问题


When I start a new Spectron application (for each test suite) I would like to fix the size of the app (for consistency across all machines and reloads).

Commands like setBounds and maximise do change dimensions, but they only do so after the app has started (which means that some components have already assumed certain dimensions, which then changes test results).

In the Spectron docs various launch options are available. I've tired to use webdriver and chromedriver options but they don't seem to work. Here is an example:

app = new Application({
     path: kElectronPath,
     webdriverOptions: {
        width:1368,
        height:769,
     },

I just assumed that the webdriver options came from the browserwindow class. How are webdriver and chromedriver options accessed in Spectron?


回答1:


This should help

 this.app = new Application({
    path: './ac.exe',
    args: ['app'],
    webdriverOptions: ({deprecationWarnings : false})
});

pass the parameters that need to be changed during app launch

and have your new application config in before hook



来源:https://stackoverflow.com/questions/48936129/how-are-webdriver-and-chromedriver-options-accessed-in-spectrons-new-applicatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!