Class SeleniumCoverageIntegration

java.lang.Object
com.parasoft.coverage.integration.selenium.SeleniumCoverageIntegration

public final class SeleniumCoverageIntegration extends Object
Provides Selenium browser configuration for the currently executing Parasoft coverage test.
  • Method Details

    • createChromeProxyConfig

      public static SeleniumCoverageIntegration.ChromeCoverageConfig createChromeProxyConfig()
      Creates Chrome options configured with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are created, so parallel browsers keep independent proxy and baggage state.

      Returns:
      browser coverage handle that must be closed after the browser session ends
    • configureProxyBaggageHeader

      public static SeleniumCoverageIntegration.ChromeCoverageConfig configureProxyBaggageHeader(org.openqa.selenium.chrome.ChromeOptions options)
      Configures the supplied Chrome options with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are configured, so parallel browsers keep independent proxy and baggage state.

      Parameters:
      options - Chrome options to configure
      Returns:
      browser coverage handle that must be closed after the browser session ends
    • createEdgeProxyConfig

      public static SeleniumCoverageIntegration.EdgeCoverageConfig createEdgeProxyConfig()
      Creates Edge options configured with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are created, so parallel browsers keep independent proxy and baggage state.

      Returns:
      Edge browser coverage handle that must be closed after the browser session ends
    • configureProxyBaggageHeader

      public static SeleniumCoverageIntegration.EdgeCoverageConfig configureProxyBaggageHeader(org.openqa.selenium.edge.EdgeOptions options)
      Configures the supplied Edge options with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are configured, so parallel browsers keep independent proxy and baggage state.

      Parameters:
      options - Edge options to configure
      Returns:
      Edge browser coverage handle that must be closed after the browser session ends
    • createFirefoxProxyConfig

      public static SeleniumCoverageIntegration.FirefoxCoverageConfig createFirefoxProxyConfig()
      Creates Firefox options configured with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are created, so parallel browsers keep independent proxy and baggage state.

      Returns:
      Firefox browser coverage handle that must be closed after the browser session ends
    • configureProxyBaggageHeader

      public static SeleniumCoverageIntegration.FirefoxCoverageConfig configureProxyBaggageHeader(org.openqa.selenium.firefox.FirefoxOptions options)
      Configures the supplied Firefox options with a dedicated Parasoft header-injecting proxy for one browser session.

      Call this method separately for each browser. The proxy captures the current test's baggage header when the browser options are configured, so parallel browsers keep independent proxy and baggage state.

      Parameters:
      options - Firefox options to configure
      Returns:
      Firefox browser coverage handle that must be closed after the browser session ends
    • configureCdpBaggageHeader

      public static void configureCdpBaggageHeader(org.openqa.selenium.chromium.HasCdp browser)
      Configures a Chrome or Edge browser session to inject the current test's Baggage header using Chrome DevTools Protocol instead of a proxy.

      Call this method after creating the WebDriver session and before navigating to the application under test. Call it separately for each browser session used by parallel tests.

      Parameters:
      browser - Chrome or Edge driver that supports CDP
    • configureCdpBaggageHeader

      public static void configureCdpBaggageHeader(org.openqa.selenium.chromium.HasCdp browser, String baggageHeader)
      Configures a Chrome or Edge browser session to inject the supplied Baggage header using Chrome DevTools Protocol instead of a proxy.

      Passing null or a blank value clears previously configured extra HTTP headers for this CDP session.

      Parameters:
      browser - Chrome or Edge driver that supports CDP
      baggageHeader - baggage value to inject, such as test-operator-id=userId or test-operator-id=userId+parallelId
    • configureCdpHeaders

      public static void configureCdpHeaders(org.openqa.selenium.chromium.HasCdp browser, Map<String,String> headers)
      Configures a Chrome or Edge browser session to inject the supplied HTTP headers using Chrome DevTools Protocol instead of a proxy.

      Passing null clears previously configured extra HTTP headers for this CDP session.

      Parameters:
      browser - Chrome or Edge driver that supports CDP
      headers - HTTP headers to inject
    • configureChromeOptions

      public static ParasoftHeaderInjectingProxy configureChromeOptions(org.openqa.selenium.chrome.ChromeOptions options)
      Starts a Parasoft header-injecting proxy using the current test's baggage header and configures the supplied Chrome options to use it.
      Parameters:
      options - Chrome options to configure
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureChromeOptions

      public static ParasoftHeaderInjectingProxy configureChromeOptions(org.openqa.selenium.chrome.ChromeOptions options, AtomicReference<String> baggageHeader)
      Starts a Parasoft header-injecting proxy using a shared baggage reference and configures the supplied Chrome options to use it.
      Parameters:
      options - Chrome options to configure
      baggageHeader - shared baggage value to inject, such as test-operator-id=userId+parallelId
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureChromeOptions

      public static ParasoftHeaderInjectingProxy configureChromeOptions(org.openqa.selenium.chrome.ChromeOptions options, ParasoftHeaderInjectingProxy proxy)
      Configures the supplied Chrome options to use an existing Parasoft header-injecting proxy.
      Parameters:
      options - Chrome options to configure
      proxy - Parasoft proxy to use
      Returns:
      the supplied proxy
    • configureEdgeOptions

      public static ParasoftHeaderInjectingProxy configureEdgeOptions(org.openqa.selenium.edge.EdgeOptions options)
      Starts a Parasoft header-injecting proxy using the current test's baggage header and configures the supplied Edge options to use it.
      Parameters:
      options - Edge options to configure
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureEdgeOptions

      public static ParasoftHeaderInjectingProxy configureEdgeOptions(org.openqa.selenium.edge.EdgeOptions options, AtomicReference<String> baggageHeader)
      Starts a Parasoft header-injecting proxy using a shared baggage reference and configures the supplied Edge options to use it.
      Parameters:
      options - Edge options to configure
      baggageHeader - shared baggage value to inject, such as test-operator-id=userId+parallelId
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureEdgeOptions

      public static ParasoftHeaderInjectingProxy configureEdgeOptions(org.openqa.selenium.edge.EdgeOptions options, ParasoftHeaderInjectingProxy proxy)
      Configures the supplied Edge options to use an existing Parasoft header-injecting proxy.
      Parameters:
      options - Edge options to configure
      proxy - Parasoft proxy to use
      Returns:
      the supplied proxy
    • configureFirefoxOptions

      public static ParasoftHeaderInjectingProxy configureFirefoxOptions(org.openqa.selenium.firefox.FirefoxOptions options)
      Starts a Parasoft header-injecting proxy using the current test's baggage header and configures the supplied Firefox options to use it.
      Parameters:
      options - Firefox options to configure
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureFirefoxOptions

      public static ParasoftHeaderInjectingProxy configureFirefoxOptions(org.openqa.selenium.firefox.FirefoxOptions options, AtomicReference<String> baggageHeader)
      Starts a Parasoft header-injecting proxy using a shared baggage reference and configures the supplied Firefox options to use it.
      Parameters:
      options - Firefox options to configure
      baggageHeader - shared baggage value to inject, such as test-operator-id=userId+parallelId
      Returns:
      proxy handle that must be closed after the browser session ends
    • configureFirefoxOptions

      public static ParasoftHeaderInjectingProxy configureFirefoxOptions(org.openqa.selenium.firefox.FirefoxOptions options, ParasoftHeaderInjectingProxy proxy)
      Configures the supplied Firefox options to use an existing Parasoft header-injecting proxy.
      Parameters:
      options - Firefox options to configure
      proxy - Parasoft proxy to use
      Returns:
      the supplied proxy