[英]Pending operations in playwright on nodejs
單擊鏈接時,我正在嘗試獲取一個新頁面:
await test.step(`Step name`, async () => {
const [newPage] = await Promise.all([
context.waitForEvent('page'),
page.click('//span[normalize-space(@title)=\'Bup\']')
]);
}
我得到了這個頁面。 對該實例的進一步操作是成功的。 但 30 秒后,測試以以下錯誤結束:
Timeout of 30000ms exceeded.
Pending operations:
- browserContext.waitForEvent at "path to the file":48:21
- at <unknown>
我假設它與 promise 有關,但我不明白問題到底是什么。 需要幫助。 編劇 v14.0,nodejs v16.7.0 。 我使用以下命令運行測試: npx playwright test tests/diag.spec.mjs --headed
一個奇怪的觀察。 當我在調試模式下運行它時,沒有這樣的錯誤:
PWDEBUG=1 npx playwright test tests/diag.spec.mjs
好的,我找到了答案,但是有點奇怪。 您需要增加劇作家配置中的超時時間:
https://github.com/microsoft/playwright/issues/8268
你也可以添加test.slow()
https://playwright.dev/docs/api/class-test#test-slow
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.