feat: wrap elements in WebElement for unified API across helpers#5497
Open
feat: wrap elements in WebElement for unified API across helpers#5497
Conversation
- Import and use WebElement wrapper in lib/els.js for all element functions - Provides consistent API (getText, getAttribute, click, etc.) across Playwright, WebDriver, Puppeteer - Update unit tests to work with WebElement instances - Add comprehensive element-based testing guide (docs/element-based-testing.md) - Update docs/els.md to remove portability warning and link to new guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace invalid assert greaterThan/lessThan with expect().to.be.above/below - Add proper chai imports in examples that use assertions - Use expect() style consistently throughout Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move API reference from element-based-testing.md to els.md - Keep element-based-testing.md as a user guide with examples - Update els.md import syntax to use ES6 imports - Add complete WebElement API reference to els.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- els.md now references WebElement.md for full API - element-based-testing.md updated to reference both docs - No content duplication, clearer documentation structure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add comprehensive acceptance tests for element(), eachElement(), expectElement(), expectAnyElement(), expectAllElements() - Update WebElement class to handle Playwright Locator objects: - type() uses fill() for Locator objects - $() and $$() use locator() and elementHandle() methods for Locator objects - Fix session_test.js import paths for ESM - 30 acceptance tests + 15 unit tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
For Playwright Locator objects, getProperty('value') should use
inputValue() method instead of evaluate() to get the current value
of input elements after fill() is called.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_locate()inWebElementclass before passing to user functionsChanges
Code Changes
WebElementand wrap elements inelement(),eachElement(),expectElement(),expectAnyElement(),expectAllElements()Tests
WebElementinstancesDocumentation
I.*with element-based)Test plan
🤖 Generated with Claude Code