Class EmulatedDeviceProfiles

java.lang.Object
com.shaft.driver.internal.DriverFactory.EmulatedDeviceProfiles

public final class EmulatedDeviceProfiles extends Object
Shared table of emulated-device profiles that SHAFT resolves to explicit device metrics instead of passing a deviceName to the browser.

Chromium's built-in DevTools emulated-device list drifts across releases (Chrome 143+ removed "Pixel 5", SHAFT's long-standing default), and an unknown deviceName fails session creation with the opaque "entry 0 of 'firstMatch' is invalid". Devices in this table always use explicit deviceMetrics + user agent, so existing configurations keep working regardless of the browser's own device list. OptionsManager and MobileTraceMetadata both read this single table so the emulation options and the recorded trace metadata can never disagree.

  • Method Details

    • of

      public static Optional<EmulatedDeviceProfiles.Profile> of(String deviceName)
      Looks up a known emulated-device profile by (case-insensitive) device name.
      Parameters:
      deviceName - configured mobileEmulationDeviceName
      Returns:
      the pinned profile, or empty when the device is not in the table
    • driftWarning

      public static String driftWarning(String deviceName)
      Builds the up-front warning logged when an unpinned device name is passed through to the browser, replacing chromedriver's opaque session-creation failure with an actionable hint.
      Parameters:
      deviceName - configured mobileEmulationDeviceName
      Returns:
      human-readable warning text