问题
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