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

Function test_get_by_title

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

Source from the content-addressed store, hash-verified

131
132
133def test_get_by_title(page: Page) -> None:
134 page.set_content(
135 """<div>
136 <input title="Hello">
137 <input title="Hello World">
138 </div>"""
139 )
140
141 expect(page.get_by_title("hello")).to_have_count(2)
142 expect(page.main_frame.get_by_title("hello")).to_have_count(2)
143 expect(page.locator("div").get_by_title("hello")).to_have_count(2)
144
145 expect(page.get_by_title("hello")).to_have_count(2)
146 expect(page.get_by_title("Hello", exact=True)).to_have_count(1)
147 expect(page.get_by_title(re.compile(r"wor", re.IGNORECASE))).to_have_count(1)
148
149 # Coverage
150 expect(page.main_frame.get_by_title("hello")).to_have_count(2)
151 expect(page.locator("div").get_by_title("hello")).to_have_count(2)
152
153
154def test_get_by_escaping(page: Page) -> None:

Callers

nothing calls this directly

Calls 4

set_contentMethod · 0.45
to_have_countMethod · 0.45
get_by_titleMethod · 0.45
locatorMethod · 0.45

Tested by

no test coverage detected