Class: Playwright::Tracing
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::Tracing
- Defined in:
- lib/playwright_api/tracing.rb
Overview
API for collecting and saving Playwright traces. Playwright traces can be opened using the Playwright CLI after Playwright script runs.
Start with specifying the folder traces will be stored in:
“‘python sync browser = chromium.launch(traceDir=’traces’) context = browser.new_context() context.tracing.start(name=“trace”, screenshots=True, snapshots=True) page.goto(“playwright.dev”) context.tracing.stop() context.tracing.export(“trace.zip”) “‘
Instance Method Summary collapse
-
#export(path) ⇒ Object
Export trace into the file with the given name.
-
#start(name: nil, screenshots: nil, snapshots: nil) ⇒ Object
Start tracing.
-
#stop ⇒ Object
Stop tracing.
Methods inherited from PlaywrightApi
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#export(path) ⇒ Object
Export trace into the file with the given name. Should be called after the tracing has stopped.
18 19 20 |
# File 'lib/playwright_api/tracing.rb', line 18 def export(path) wrap_impl(@impl.export(unwrap_impl(path))) end |
#start(name: nil, screenshots: nil, snapshots: nil) ⇒ Object
Start tracing.
“‘python sync context.tracing.start(name=“trace”, screenshots=True, snapshots=True) page.goto(“playwright.dev”) context.tracing.stop() context.tracing.export(“trace.zip”) “`
30 31 32 |
# File 'lib/playwright_api/tracing.rb', line 30 def start(name: nil, screenshots: nil, snapshots: nil) wrap_impl(@impl.start(name: unwrap_impl(name), screenshots: unwrap_impl(screenshots), snapshots: unwrap_impl(snapshots))) end |
#stop ⇒ Object
Stop tracing.
35 36 37 |
# File 'lib/playwright_api/tracing.rb', line 35 def stop wrap_impl(@impl.stop) end |