0
 switchToPopUpWindow(n = -1) {
    this.mainWindow = browser.getCurrentTabId()

    let handles = browser.windowHandles()
    n == -1 && (n = handles.value.length - 1)
    browser.window(handles.value[n])

    return this
  }

包.json

"@wdio/cli": "^6.7.0",
    "@wdio/junit-reporter": "~6.7.0",
    "@wdio/local-runner": "^6.7.0",
    "@wdio/mocha-framework": "^6.7.0",
    "@wdio/selenium-standalone-service": "^6.6.5",
    "@wdio/spec-reporter": "^6.7.0",
    "@wdio/sync": "^6.7.0",
    "wdio-chromedriver-service": "^6.0.4",
    "wdio-mochawesome-reporter": "^4.0.0",
    "webdriverio": "^6.7.0",

这是我们在版本 5 中使用的方法getcurrentTabIDwindowHandles方法,但在 v6 中它不是函数。所以我该怎么做?请帮忙谢谢

4

1 回答 1

1

从 v5 开始,它已更改。您现在可以使用https://webdriver.io/docs/api/webdriver.html#getwindowhandle

于 2020-12-07T06:39:27.810 回答