【发布时间】:2017-01-06 11:57:59
【问题描述】:
我们需要测试Electron App。 我们使用的是 Spectron,它使用的是 ChromeDriver 和 WebdriverIO(用于 NodeJS 的 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()');
});
知道如何从开发工具切换到主窗口吗?
【问题讨论】:
标签: javascript node.js selenium electron webdriver-io