Repository navigation
Give Python assertion rows the element their value was read from - #475
Merged
Merged
Conversation
A pytest assert compares values, so its row named no element and the dashboard could not box what the assertion was about, while the JS adapters' rows carried the locator through value provenance. The Python adapter cannot import core's registry, so it keeps its own: every captured command records its result against its selector (None for a driver-level read, so a title assertion never borrows an element that reads the same text), script atoms such as get_attribute and is_displayed resolve the element passed to them, and the assertion row looks up the observed operand first. With the gap closed, the conformance allowlist entry, its Known debt reason and the CLAUDE.md bullet describing it go too. Closes #462
Contributor
[Low impact] The PR appears safe to merge; no new actionable defects were found. SummaryPython assertion rows now use remembered command results to find the element they describe.
Reviews (3) · Last reviewed commit: "Merge origin/main into fix/462-python-as..." · Reviewed by Greptile |
…nown A plain script's assertion on an attribute such as driver.title cannot see the value that was read, so the target fell back to the expected literal and could box an element that once read the same text. With the observed side unknown, the row now carries no target.
2 of 18 tasks
vishnuv688
added a commit
that referenced
this pull request
Oct 28, 2026
#475 added the Python half of the value-provenance entry; the rule this branch adds is stated once for both languages.
This was referenced Oct 28, 2026
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.
What & why
Closes #462.
An assertion row from pytest's plain
assertnamed no element, so the dashboard could not box what the assertion was about. The JS adapters get this from value provenance (core/read-value-locators.ts); the Python adapter had no counterpart, and the conformance suite carried it as a known gap (lacksTargets: ['Assert.equal']).The Python adapter now keeps the same registry in
selenium_devtools/read_value_locators.py, since it cannot import core:execute: same bounds as core (200 values, strings of at most 256 chars, primitives only, newest producer wins), keyed by type as well soTrueand1stay apart.driver.title,current_url) recordsNone, so a title assertion never borrows the box of an element whose text reads the same.get_attributeandis_displayedreach the wire asw3cExecuteScriptatoms, so their element comes from the script's arguments (element_locators.selector_for_script_element).assertions.comparison_target), and an operand recorded as no element's ends the search, so a literal some element once read cannot hand a title assertion that element's box.The conformance allowlist entry, its
KNOWN_DEBT.pythonAssertTargetreason and the CLAUDE.md debt bullet are removed; the value-provenance bullet in CLAUDE.md now describes the Python side. Nofeatures.tscell names this, so the capability tables are unchanged (pnpm docs:capabilities --checkpasses).Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Also
packages/conformance(allowlist and one agreement test fixture).Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviourNo cell covers assertion targets;
pnpm docs:capabilities --checkpasses unchanged.Notes for reviewers
Evidence:
tests/test_read_value_locators.py(14 tests). With the wiring reverted, the 5 end-to-end row tests fail. With theNonesentinel removed (driver-level reads not recorded), the title-vs-element collision test fails with the title assertion carryingselector: 'h1'.npx vitest run packages/conformance/tests/conformance.test.ts) passes 3 of 3 runs with the gap removed. Withassertion_targetforced to return nothing, it fails in all three BiDi modes ondevtools-service shows [Assert.equal #flash], selenium-devtools-py shows [Assert.equal](and the same forh2), so the Python adapter really runs there.agreement.test.tsused the removed gap to exercise target dropping; its fixture's Python assertion now carries#flash, since that is what the adapter shows. ThelacksTargetsmechanism itself is kept, with no gap using it today.Checks: Python suite 777 passed, 2 failed (
test_an_abandoned_driver_is_not_retained,test_the_recorder_does_not_retain_its_driver, both failing identically onorigin/mainin this environment);pnpm build,pnpm test(3017 passed),pnpm lint(0 errors),pnpm typecheck,pnpm docs:capabilities --check,scripts/changes.py checkall green.Known residuals, as in the JS registry: a boolean read is weakly discriminating, and a value collision with no intervening producer can still mis-attribute. A user
execute_scriptthat takes an element argument now attributes its returned value to that element too.Not verified in a real browser here beyond the conformance harness's fake WebDriver. To check the box in the dashboard:
then select the
"You logged into a secure area" in flashrow: the overlay should box the flash message, while the"/secure" in current_urlrow (a driver-level read) should box nothing.Screenshots / recordings
Not a UI change.
🤖 Generated with Claude Code