[英]Pending operations in playwright on nodejs
I'm trying to get a new page at the moment of clicking on the link:单击链接时,我正在尝试获取一个新页面:
await test.step(`Step name`, async () => {
const [newPage] = await Promise.all([
context.waitForEvent('page'),
page.click('//span[normalize-space(@title)=\'Bup\']')
]);
}
And I get this page.我得到了这个页面。 Further operations with this instance are successful.对该实例的进一步操作是成功的。 But after 30 seconds the test ends with the following error:但 30 秒后,测试以以下错误结束:
Timeout of 30000ms exceeded.
Pending operations:
- browserContext.waitForEvent at "path to the file":48:21
- at <unknown>
I will assume that it is related to a promise, but I do not understand what exactly the problem is.我假设它与 promise 有关,但我不明白问题到底是什么。 Help is needed.需要帮助。 Playwright v14.0, nodejs v16.7.0 .编剧 v14.0,nodejs v16.7.0 。 I run the tests with the following command: npx playwright test tests/diag.spec.mjs --headed
我使用以下命令运行测试: npx playwright test tests/diag.spec.mjs --headed
A strange observation.一个奇怪的观察。 When I run it in debug mode, there is no such error :当我在调试模式下运行它时,没有这样的错误:
PWDEBUG=1 npx playwright test tests/diag.spec.mjs
Ok, I found the answer, but it's a little weird.好的,我找到了答案,但是有点奇怪。 You need to increase the timeout in the playwright config:您需要增加剧作家配置中的超时时间:
https://github.com/microsoft/playwright/issues/8268 https://github.com/microsoft/playwright/issues/8268
Also you can add test.slow()
https://playwright.dev/docs/api/class-test#test-slow你也可以添加test.slow()
https://playwright.dev/docs/api/class-test#test-slow
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.