首页 > 解决方案 > webdriver.io browser.debug() 在异步函数中不起作用。为什么不是?

问题描述

一个简化的视图~

在这种情况下工作:

it("should confirm the the prop", () => {
  browser.debug() // works fine
})

在这种情况下不起作用:

it("should confirm the the prop", async() => {
  browser.debug() // doesn't `freeze` the driven browser for debugging
})

标签: javascriptwebdriver

解决方案


尽管这让我困惑了一段时间,但当我公开这个问题时,就会弹出一个答案。browser.debug()需要一个await.

现在它起作用了:

it("should confirm the the prop", async() => {
  await browser.debug()
})

推荐阅读