class Playwright::Tracing
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() context = browser.new_context() context.tracing.start(screenshots=True, snapshots=True) page.goto(“playwright.dev”) context.tracing.stop(path = “trace.zip”) “`
Public Instance Methods
start(name: nil, screenshots: nil, snapshots: nil)
click to toggle source
Start tracing.
“`python sync context.tracing.start(name=“trace”, screenshots=True, snapshots=True) page.goto(“playwright.dev”) context.tracing.stop() context.tracing.stop(path = “trace.zip”) “`
# File lib/playwright_api/tracing.rb, line 24 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(path: nil)
click to toggle source
Stop tracing.
# File lib/playwright_api/tracing.rb, line 29 def stop(path: nil) wrap_impl(@impl.stop(path: unwrap_impl(path))) end