Closed
Description
Version
Version 1.50.0
Steps to reproduce
- Create a virtual environment and install Playwright:
- python3 -m venv .venv
- source .venv/bin/activate
- pip install playwright
- Use the following code in VSCode:
from playwright.sync_api import sync_playwright, expect, Locator
def run():
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
locator: Locator = page.locator("text=Submit")
result = expect(locator)
result.to_be_ # <- IntelliSense does not suggest anything here
- Hovering over result or using reveal_type(result) shows "No definition found" or Unknown.
Expected behavior
VS Code should suggest assertion methods like .to_be_visible(), .to_be_hidden(), etc., when using expect(locator).
Actual behavior
When using expect(locator) in Playwright Python, IntelliSense/autocompletion in VS Code (with Pylance) does not suggest any .to_be_... assertion methods, even when the locator is explicitly typed.
Additional context
No response
Environment
OS: macOS
Python: 3.12.3
Playwright: 1.50.0
VS Code: 1.101.1 (Universal)
Metadata
Metadata
Assignees
Labels
No labels