-
-
Notifications
You must be signed in to change notification settings - Fork 753
[WIP] [FEATURE REQUEST](puppeteer) migrate locators from ElementHandle to Locator #5096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.