Interface DriverProvider

All Known Implementing Classes:
PooledDriverProvider

public interface DriverProvider
Provider for browser driver instances.

Implementations can manage driver lifecycle in different ways:

  • Per-scenario: create new driver for each scenario (default behavior)
  • Per-thread: reuse driver within same thread (ThreadLocal pattern)
  • Pooled: maintain a pool of drivers, borrow/return

Example usage with Runner:

 Runner.path("features/")
     .driverProvider(new CdpPooledProvider(browserWsUrl))
     .parallel(4);
 
  • Method Details

    • acquire

      Driver acquire(ScenarioRuntime runtime, Map<String,Object> config)
      Acquire a driver instance for a scenario.

      Called when a scenario first accesses the driver (lazy initialization). The provider may create a new driver, return one from a pool, or return a thread-local cached instance.

      Parameters:
      runtime - the scenario runtime requesting the driver
      config - driver configuration from configure driver = {...}
      Returns:
      a driver instance
    • release

      void release(ScenarioRuntime runtime, Driver driver)
      Release a driver instance after scenario completion.

      Called when a scenario ends. The provider may close the driver, return it to a pool, or keep it cached for the thread.

      Parameters:
      runtime - the scenario runtime that used the driver
      driver - the driver to release
    • shutdown

      void shutdown()
      Shutdown the provider and close all managed drivers.

      Called when the Suite completes. All drivers should be closed.