我们需要测试
Electron
应用程序。
我们正在使用
Spectron
其使用ChromeDriver
WebdriverIO
(NodeJ的Selenium 2.0绑定)。
问题:
我们的应用程序从打开的开发工具窗口开始,而不是显示主应用程序窗口。Webdriver连接到开发工具窗口而不是主窗口。我们无法切换到主窗口。
示例代码:
var app = new Application({
path: cfg.pathToElectron,
args: [cfg.pathToSA]
});
app.start().then(function(){
app.client // <- this is dev tools window instead of main window
// this closes the dev tools which is ok but we need to switch to main window
app.client.close();
// things like this doesn't help
app.client.execute('xxx.getCurrentWindow().closeDevTools()');
});
如何从开发工具切换到主窗口?