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

Class TraceViewerPage

tests/sync/conftest.py:132–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

_show_trace_viewerFunction · 0.70

Calls

no outgoing calls

Tested by 1

_show_trace_viewerFunction · 0.56