fix: Playwright API camelCase → snake_case (Python 版)
- getByPlaceholder → get_by_placeholder - getByRole → get_by_role - getByText → get_by_text - getByTestId → get_by_test_id
This commit is contained in:
@@ -6,8 +6,8 @@ Usage:
|
||||
class LoginPage(BasePage):
|
||||
def __init__(self, page):
|
||||
super().__init__(page)
|
||||
self.phone_input = page.getByPlaceholder("请输入用户名")
|
||||
self.login_btn = page.getByRole("button", name="登录")
|
||||
self.phone_input = page.get_by_placeholder("请输入用户名")
|
||||
self.login_btn = page.get_by_role("button", name="登录")
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
@@ -38,7 +38,7 @@ class BasePage:
|
||||
|
||||
def wait_for_text(self, text: str, timeout_ms: Optional[int] = None) -> None:
|
||||
"""等待页面上出现指定文本。"""
|
||||
expect(self.page.getByText(text)).to_be_visible(timeout=timeout_ms or self.timeout)
|
||||
expect(self.page.get_by_text(text)).to_be_visible(timeout=timeout_ms or self.timeout)
|
||||
|
||||
# ── 通用操作 ──
|
||||
|
||||
|
||||
Reference in New Issue
Block a user