microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 768 forks source link

Pylance error for query_selector of Playwright #5726

Open Akopov4 opened 5 months ago

Akopov4 commented 5 months ago

Environment data

Code Snippet

from playwright.sync_api import Playwright

@fixture
def get_playwright() -> Generator[Playwright, Any, None]:
    with sync_playwright() as playwright:
        yield playwright

def test_playwright(get_playwright, headless=False):
    playwright1 = get_playwright
    browser = playwright1.chromium.launch(headless=headless)
    context = browser.new_context()
    page = context.new_page()
    base_url = 'https://www.bing.com/?cc=ua'
    page.goto(base_url)
    row = page.query_selector(f'css=tr >> text=""')
    row.query_selector(".deleteBtn").click()
    print('')
    assert 5 != 1

Repro Steps

  1. XXX

Expected behavior

No Pylance Errors should be

Actual behavior

"query_selector" is not a known member of "None" "click" is not a known member of "None"

Logs

vscode_log.txt

Requirements

requirements.txt

bschnurr commented 5 months ago

sounds like duplicate of https://github.com/microsoft/pylance-release/issues/5718

Better support for fixtures that return generatros

Akopov4 commented 3 weeks ago

Accidentally closed this issue