Skip to content

[BUG] Bad bool to str conversion for get_by_role kwargs #1813

@aikow

Description

@aikow

Context:

  • Playwright Version: 1.31.1 (latest)
  • System: Mac
  • Python version: 3.10.9
  • Browser: All
  • Extra: N/A

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally.

from playwright.sync_api import Playwright, sync_playwright, expect

with sync_playwright() as playwright:
    browser = playwright.chromium.launch(headless=False)
    context = browser.new_context()
    page = context.new_page()

    page.goto("https://github.com/microsoft/playwright-python")
    page.locator("summary").filter(has_text="Code").click()

    with page.expect_download() as download_info:
        page.get_by_role("link", name="Download ZIP").click()  # <-- Error here
    download = download_info.value
    
    page.close()
    context.close()
    browser.close()

Describe the bug

error in callback: Error: "include-hidden" must be one of true, false
    at validateSupportedValues (<anonymous>:2692:11)
    at validateAttributes (<anonymous>:2756:9)
    at Object.queryAll (<anonymous>:2823:23)
    at InjectedScript._queryEngineAll (<anonymous>:4435:49)
    at InjectedScript.querySelectorAll (<anonymous>:4422:30)
    at eval (eval at evaluate (:197:30), <anonymous>:4:35)
    at UtilityScript.evaluate (<anonymous>:199:17)
    at UtilityScript.<anonymous> (<anonymous>:1:44)
=========================== logs ===========================
waiting for get_by_role("button", name="Download Shared screen with speaker view", include_hidden="True")
============================================================

I found this MR, which fixed a typo in playwright/_impl/_locator.py. That same method also just does a cast from a python bool to str, which will result in "True" and "False", and not "true" and "false".

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions