我有一些使用 wdio 的集成测试,它们都通过了。但是,当我在无头 chrome 中运行它们时,这些测试之一失败了。我收到此错误:
1) Reset password by submitting a new password "before all" hook:
element ("#identifierNext") still not existing after 15000ms
问题出在这行代码中:
browser.waitForExist('#identifierNext');
这很奇怪,因为我waitForExist(<element id>)也在其他测试中使用了,它们甚至在无头 chrome 中也通过了。我还尝试将waitFor限制增加到 30000 毫秒,但无论如何还是失败了。
这是我的 wdio 配置:
exports.config = {
specs: [
'./test/pageobjects/**/reset_password.spec.js'
],
maxInstances: 1,
capabilities: [{
maxInstances: 1,
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--headless', '--disable-gpu', '--window-size=1280,800', '--no-sandbox', '--disable-dev-shm-usage']
}
}],
sync: true,
logLevel: 'silent',
coloredLogs: true,
deprecationWarnings: true,
bail: 0,
screenshotPath: './errorShots/',
baseUrl: 'http://127.0.0.1:3000',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ['selenium-standalone'],
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 30000
},
}
当我headless从 中删除时chromeOptions,此测试正常通过。任何想法为什么会发生这种情况?
慕码人2483693
相关分类