()
| 445 | } |
| 446 | |
| 447 | async activeElement() { |
| 448 | await this.raf(); |
| 449 | |
| 450 | return await this.page.evaluateHandle(() => { |
| 451 | let activeElement = document.activeElement; |
| 452 | |
| 453 | while (activeElement?.shadowRoot) { |
| 454 | activeElement = activeElement.shadowRoot.activeElement; |
| 455 | } |
| 456 | |
| 457 | if (!activeElement) { |
| 458 | throw new Error('No active element found'); |
| 459 | } |
| 460 | |
| 461 | return activeElement; |
| 462 | }); |
| 463 | } |
| 464 | |
| 465 | async activeElementTextContent() { |
| 466 | const element = await this.activeElement(); |