[WIP] [FEATURE REQUEST](puppeteer) migrate locators from ElementHandle to Locator#5096
[WIP] [FEATURE REQUEST](puppeteer) migrate locators from ElementHandle to Locator#5096kobenguyent merged 4 commits into3.xfrom
Conversation
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
|
@copilot fix puppeteer acceptance tests failed with error locatorElement.all is not a function |
Fixed the "locatorElement.all is not a function" error by removing incorrect Puppeteer Locator API usage. The issue was that Puppeteer's Locator API doesn't have |
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
|
@copilot fix type tests due to this change |
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>
Fixed TypeScript type definition issues. The problem was with JSDoc type annotations in the new Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Migration plan for Puppeteer helper from ElementHandle to Locator API to match modern Puppeteer practices and consistency with Playwright implementation.
Migration Plan:
buildLocatorStringfunction similar to PlaywrightfindElementfunction that returns single ElementHandlefindElementsto use Locator API with ElementHandle fallback_locateElementhelper method for single element operationsfocus,blur, and_locateCheckablemethods to use optimized approachesmoveCursorTo,scrollIntoView,waitForClickable,proceedDragAndDrop)Key Features Implemented:
🚀 Hybrid Locator/ElementHandle Architecture
matcher.locator())$$(),$x()) for compatibilitywaitHandle()for seamless integration⚡ Performance Optimizations
_locateElement()method for single-element operations (avoids array overhead)focus(),blur(),moveCursorTo(),scrollIntoView(),waitForClickable(),_locateCheckable(),proceedDragAndDrop()🛡️ Enhanced Reliability
📚 Comprehensive Documentation
✅ Validated Compatibility
Technical Implementation Details:
buildLocatorString(): Converts CodeceptJS Locator objects to Puppeteer locator stringsfindElements(): Uses Locator API first, falls back to legacy methodsfindElement(): Optimized single-element version with same fallback strategyFixes #3972.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.