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

Method $$

lib/element/WebElement.js:435–460  ·  view source on GitHub ↗

* Find all child elements matching the locator * @param {string|Object} locator Element locator * @returns {Promise } Array of WebElement instances

(locator)

Source from the content-addressed store, hash-verified

433 * @returns {Promise<WebElement[]>} Array of WebElement instances
434 */
435 async $$(locator) {
436 let childElements
437
438 switch (this.helperType) {
439 case 'playwright':
440 // Playwright Locator objects use locator() method
441 if (this.element.locator) {
442 const childLocator = this.element.locator(this._normalizeLocator(locator))
443 // Get all element handles from the locator
444 childElements = await childLocator.elementHandles()
445 } else {
446 childElements = await this.element.$$(this._normalizeLocator(locator))
447 }
448 break
449 case 'webdriver':
450 childElements = await this.element.$$(this._normalizeLocator(locator))
451 break
452 case 'puppeteer':
453 childElements = await this.element.$$(this._normalizeLocator(locator))
454 break
455 default:
456 throw new Error(`Unsupported helper type: ${this.helperType}`)
457 }
458
459 return childElements.map(el => new WebElement(el, this.helper))
460 }
461
462 /**
463 * Normalize locator for element search

Callers 15

findElementsFunction · 0.80
findElementFunction · 0.80
findClickableFunction · 0.80
findCheckableFunction · 0.80
findFieldsFunction · 0.80
proceedSeeInFieldFunction · 0.80
findByRoleFunction · 0.80
proceedSelectFunction · 0.80
swipeToMethod · 0.80
_resMethod · 0.80
_withinBeginMethod · 0.80
_locateShadowMethod · 0.80

Calls 1

_normalizeLocatorMethod · 0.95

Tested by

no test coverage detected