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

Method _withinBegin

lib/helper/Puppeteer.js:695–718  ·  view source on GitHub ↗
(locator)

Source from the content-addressed store, hash-verified

693 }
694
695 async _withinBegin(locator) {
696 if (this.withinLocator) {
697 throw new Error("Can't start within block inside another within block")
698 }
699
700 const frame = isFrameLocator(locator)
701
702 if (frame) {
703 if (Array.isArray(frame)) {
704 return this.switchTo(null).then(() => frame.reduce((p, frameLocator) => p.then(() => this.switchTo(frameLocator)), Promise.resolve()))
705 }
706 await this.switchTo(frame)
707 this.withinLocator = new Locator(frame)
708 return
709 }
710
711 const el = await this._locateElement(locator)
712 if (!el) {
713 throw new ElementNotFound(locator, 'Element for within context')
714 }
715 this.context = el
716
717 this.withinLocator = new Locator(locator)
718 }
719
720 async _withinEnd() {
721 this.withinLocator = null

Callers

nothing calls this directly

Calls 3

switchToMethod · 0.95
_locateElementMethod · 0.95
isFrameLocatorFunction · 0.70

Tested by

no test coverage detected