* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab * * ```js * I.switchToNextTab(); * I.switchToNextTab(2); * ``` * * @param {number} [num=1]
(num = 1)
| 1853 | * @param {number} [num=1] |
| 1854 | */ |
| 1855 | async switchToNextTab(num = 1) { |
| 1856 | if (this.isElectron) { |
| 1857 | throw new Error('Cannot switch tabs inside an Electron container') |
| 1858 | } |
| 1859 | const pages = await this.browserContext.pages() |
| 1860 | |
| 1861 | const index = pages.indexOf(this.page) |
| 1862 | this.withinLocator = null |
| 1863 | const page = pages[index + num] |
| 1864 | |
| 1865 | if (!page) { |
| 1866 | throw new Error(`There is no ability to switch to next tab with offset ${num}`) |
| 1867 | } |
| 1868 | await targetCreatedHandler.call(this, page) |
| 1869 | await this._setPage(page) |
| 1870 | return this._waitForAction() |
| 1871 | } |
| 1872 | |
| 1873 | /** |
| 1874 | * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab |
nothing calls this directly
no test coverage detected