* Find all child elements matching the locator * @param {string|Object} locator Element locator * @returns {Promise } Array of WebElement instances
(locator)
| 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 |
no test coverage detected