MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / waitForNumberOfTabs

Method waitForNumberOfTabs

lib/helper/WebDriver.js:2763–2776  ·  view source on GitHub ↗

* {{> waitForNumberOfTabs }}

(expectedTabs, sec)

Source from the content-addressed store, hash-verified

2761 * {{> waitForNumberOfTabs }}
2762 */
2763 async waitForNumberOfTabs(expectedTabs, sec) {
2764 const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeoutInSeconds
2765 let currentTabs
2766 let count = 0
2767
2768 do {
2769 currentTabs = await this.grabNumberOfOpenTabs()
2770 await this.wait(1)
2771 count += 1000
2772 if (currentTabs >= expectedTabs) return
2773 } while (count <= waitTimeout)
2774
2775 throw new Error(`Expected ${expectedTabs} tabs are not met after ${waitTimeout / 1000} sec.`)
2776 }
2777
2778 /**
2779 * {{> switchTo }}

Callers

nothing calls this directly

Calls 2

grabNumberOfOpenTabsMethod · 0.95
waitMethod · 0.95

Tested by

no test coverage detected