Class: Playwright::Tracing

Inherits:
PlaywrightApi show all
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() context = browser.new_context() context.tracing.start(screenshots=True, snapshots=True) page.goto(“playwright.dev”) context.tracing.stop(path = “trace.zip”) “`

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#initialize, unwrap, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#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.stop(path = “trace.zip”) “`



24
25
26
# 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) ⇒ Object

Stop tracing.



29
30
31
# File 'lib/playwright_api/tracing.rb', line 29

def stop(path: nil)
  wrap_impl(@impl.stop(path: unwrap_impl(path)))
end