MCPcopy Index your code
hub / github.com/microsoft/playwright-python / TraceViewerPage

Class TraceViewerPage

tests/async/conftest.py:142–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140
141
142class TraceViewerPage:
143 def __init__(self, page: Page):
144 self.page = page
145
146 @property
147 def actions_tree(self) -> Locator:
148 return self.page.get_by_test_id("actions-tree")
149
150 @property
151 def action_titles(self) -> Locator:
152 return self.page.locator(".action-title")
153
154 @property
155 def stack_frames(self) -> Locator:
156 return self.page.get_by_role("listbox", name="Stack trace").get_by_role(
157 "option"
158 )
159
160 async def select_action(self, title: str, ordinal: int = 0) -> None:
161 await self.page.locator(".action-title", has_text=title).nth(ordinal).click()
162
163 async def select_snapshot(self, name: str) -> None:
164 await self.page.click(
165 f'.snapshot-tab .tabbed-pane-tab-label:has-text("{name}")'
166 )
167
168 async def snapshot_frame(
169 self, action_name: str, ordinal: int = 0, has_subframe: bool = False
170 ) -> FrameLocator:
171 await self.select_action(action_name, ordinal)
172 expected_frames = 4 if has_subframe else 3
173 while len(self.page.frames) < expected_frames:
174 await self.page.wait_for_event("frameattached")
175 return self.page.frame_locator("iframe.snapshot-visible[name=snapshot]")
176
177 async def show_source_tab(self) -> None:
178 await self.page.click("text='Source'")
179
180 async def expand_action(self, title: str, ordinal: int = 0) -> None:
181 await self.actions_tree.locator(".tree-view-entry", has_text=title).nth(
182 ordinal
183 ).locator(".codicon-chevron-right").click()
184
185
186@pytest.fixture

Callers 1

_show_trace_viewerFunction · 0.70

Calls

no outgoing calls

Tested by 1

_show_trace_viewerFunction · 0.56