Skip to content

[Docs]: Fix incorrect Python method name in Locator.and_ example #37250

@papple23g

Description

@papple23g

Page(s)

https://playwright.dev/python/docs/api/class-locator#locator-and

Description

Issue Description

In the documentation file docs/src/api/class-locator.md, the Python code examples for the Locator.and method use an incorrect camelCase method name getByTitle instead of the correct snake_case get_by_title.

Current Code (Incorrect)

# Python async
button = page.get_by_role("button").and_(page.getByTitle("Subscribe"))

# Python sync  
button = page.get_by_role("button").and_(page.getByTitle("Subscribe"))

Expected Code (Correct)

# Python async
button = page.get_by_role("button").and_(page.get_by_title("Subscribe"))

# Python sync
button = page.get_by_role("button").and_(page.get_by_title("Subscribe"))

Location

  • File: docs/src/api/class-locator.md
  • Lines: 136, 140
  • Section: Locator.and method examples

Impact

This causes confusion for Python developers following the documentation, as getByTitle is not a valid method in the Playwright Python API. The correct method name should follow Python's snake_case convention: get_by_title.

Solution

Change getByTitle to get_by_title in both Python async and sync code examples to match the actual Playwright Python API.

Additional Context

I have already prepared a fix for this issue and am ready to submit a pull request once this issue is created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions