Class TracingImpl

All Implemented Interfaces:
Tracing

class TracingImpl extends ChannelOwner implements Tracing
  • Field Details

    • includeSources

      private boolean includeSources
    • tracesDir

      private Path tracesDir
    • isTracing

      private boolean isTracing
    • stacksId

      private String stacksId
  • Constructor Details

  • Method Details

    • stopChunkImpl

      private void stopChunkImpl(Path path)
    • startChunk

      public void startChunk(Tracing.StartChunkOptions options)
      Description copied from interface: Tracing
      Start a new trace chunk. If you'd like to record multiple traces on the same BrowserContext, use Tracing.start() once, and then create multiple trace chunks with Tracing.startChunk() and Tracing.stopChunk().

      **Usage**

      context.tracing().start(new Tracing.StartOptions()
        .setScreenshots(true)
        .setSnapshots(true));
      Page page = context.newPage();
      page.navigate("https://playwright.dev");
      
      context.tracing().startChunk();
      page.getByText("Get Started").click();
      // Everything between startChunk and stopChunk will be recorded in the trace.
      context.tracing().stopChunk(new Tracing.StopChunkOptions()
        .setPath(Paths.get("trace1.zip")));
      
      context.tracing().startChunk();
      page.navigate("http://example.com");
      // Save a second trace file with different actions.
      context.tracing().stopChunk(new Tracing.StopChunkOptions()
        .setPath(Paths.get("trace2.zip")));
      
      Specified by:
      startChunk in interface Tracing
    • tracingStartChunk

      private void tracingStartChunk(String name, String title)
    • startCollectingStacks

      private void startCollectingStacks(String traceName)
    • start

      public void start(Tracing.StartOptions options)
      Description copied from interface: Tracing
      Start tracing.

      **Usage**

      context.tracing().start(new Tracing.StartOptions()
        .setScreenshots(true)
        .setSnapshots(true));
      Page page = context.newPage();
      page.navigate("https://playwright.dev");
      context.tracing().stop(new Tracing.StopOptions()
        .setPath(Paths.get("trace.zip")));
      
      Specified by:
      start in interface Tracing
    • stop

      public void stop(Tracing.StopOptions options)
      Description copied from interface: Tracing
      Stop tracing.
      Specified by:
      stop in interface Tracing
    • stopChunk

      public void stopChunk(Tracing.StopChunkOptions options)
      Description copied from interface: Tracing
      Stop the trace chunk. See Tracing.startChunk() for more details about multiple trace chunks.
      Specified by:
      stopChunk in interface Tracing
    • setTracesDir

      void setTracesDir(Path tracesDir)