MCPcopy Create free account
hub / github.com/microsoft/playwright-python / test_get_by_placeholder

Function test_get_by_placeholder

tests/sync/test_locator_get_by.py:91–109  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

89
90
91def test_get_by_placeholder(page: Page) -> None:
92 page.set_content(
93 """<div>
94 <input placeholder="Hello">
95 <input placeholder="Hello World">
96 </div>"""
97 )
98
99 expect(page.get_by_placeholder("hello")).to_have_count(2)
100 expect(page.main_frame.get_by_placeholder("hello")).to_have_count(2)
101 expect(page.locator("div").get_by_placeholder("hello")).to_have_count(2)
102
103 expect(page.get_by_placeholder("hello")).to_have_count(2)
104 expect(page.get_by_placeholder("Hello", exact=True)).to_have_count(1)
105 expect(page.get_by_placeholder(re.compile(r"wor", re.IGNORECASE))).to_have_count(1)
106
107 # Coverage
108 expect(page.main_frame.get_by_placeholder("hello")).to_have_count(2)
109 expect(page.locator("div").get_by_placeholder("hello")).to_have_count(2)
110
111
112def test_get_by_alt_text(page: Page) -> None:

Callers

nothing calls this directly

Calls 4

set_contentMethod · 0.45
to_have_countMethod · 0.45
get_by_placeholderMethod · 0.45
locatorMethod · 0.45

Tested by

no test coverage detected