-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
Version
1.42
Steps to reproduce
Example test:
const { chromium, test, expect } = require( '@playwright/test' );
test( 'locator chaining regression', async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.setContent( `
<ul>
<li aria-label="Dogs">
Dogs
<ul>
<li>chihuahua</li>
<li>rottweiler</li>
</ul>
</li>
</ul>
` );
const animas = page
.getByRole( 'listitem', { name: 'Dogs' } )
.getByRole( 'listitem' );
await expect( animas ).toHaveText( [ 'chihuahua', 'rottweiler' ] );
await expect( animas ).toHaveCount( 2 );
} );Steps:
- Run this test.
- Observe failure in v1.42
Expected behavior
The chained locator should resolve two elements.
Actual behavior
The chained locator resolves three elements, including the parent.
Additional context
No response
Environment
System:
OS: macOS 13.3
Memory: 545.13 MB / 16.00 GB
Binaries:
Node: 20.10.0 - ~/Library/Caches/fnm_multishells/9899_1709293478760/bin/node
Yarn: 1.22.18 - /opt/homebrew/bin/yarn
npm: 10.2.3 - ~/Library/Caches/fnm_multishells/9899_1709293478760/bin/npm
Languages:
Bash: 3.2.57 - /bin/bash
Playwright: v1.42Reactions are currently unavailable