Currently, there is a fundamental disconnect between network-level identity and the navigator.userAgentData Web API. While automation tools can use network.setExtraHeaders to inject Sec-CH-UA-* headers (like Sec-CH-UA-Mobile: ?1) into outgoing requests, they cannot modify the underlying browser state that feeds the navigator API.
This results in a fragmented environment where:
- Headers say the device is mobile.
- Web APIs report the device is desktop.
Because the UA-CH specification designed navigator.userAgentData.mobile and high-entropy hints (like model and platformVersion) to be the primary signals for modern web applications, the inability to override these values makes full mobile emulation impossible.
Scenarios
API-Driven Responsive Logic
Enabling tests for applications that toggle between mobile and desktop UI components based on the navigator.userAgentData.mobile boolean rather than just screen width.
High-Entropy Hardware Simulation
Simulating specific mobile hardware profiles (e.g., model: "Pixel 8", platform: "Android") to validate device-specific performance optimizations or feature availability.
Proposed Solution
Specify a new WebDriver BiDi command emulation.setClientHintsUserAgentOverride:
emulation.SetClientHintsUserAgentOverrideCommand = {
method: "emulation.setClientHintsUserAgentOverride",
params: {
clientHints: emulation.ClientHintsUserAgentMetadata / null,
? contexts: [+browsingContext.BrowsingContext],
? userContexts: [+browser.UserContext],
}
}
emulation.ClientHintsUserAgentMetadata = {
? brands: [* emulation.BrandVersion],
? fullVersionList: [* emulation.BrandVersion],
? platform: text,
? platformVersion: text,
? architecture: text,
? model: text,
? mobile: bool,
? bitness: text,
? wow64: bool,
? formFactors: [* text];
}
emulation.BrandVersion = {
brand: text,
version: text
}
Alternative solution
Extend existing emulation.setUserAgentOverride command:
emulation.SetUserAgentOverrideParameters = {
userAgent: text / null,
? clientHints: emulation.ClientHintsUserAgentMetadata / null,
? contexts: [+browsingContext.BrowsingContext],
? userContexts: [+browser.UserContext],
}
Currently, there is a fundamental disconnect between network-level identity and the
navigator.userAgentDataWeb API. While automation tools can usenetwork.setExtraHeadersto injectSec-CH-UA-*headers (likeSec-CH-UA-Mobile: ?1) into outgoing requests, they cannot modify the underlying browser state that feeds the navigator API.This results in a fragmented environment where:
Because the UA-CH specification designed
navigator.userAgentData.mobileand high-entropy hints (likemodelandplatformVersion) to be the primary signals for modern web applications, the inability to override these values makes full mobile emulation impossible.Scenarios
API-Driven Responsive Logic
Enabling tests for applications that toggle between mobile and desktop UI components based on the
navigator.userAgentData.mobileboolean rather than just screen width.High-Entropy Hardware Simulation
Simulating specific mobile hardware profiles (e.g., model: "Pixel 8", platform: "Android") to validate device-specific performance optimizations or feature availability.
Proposed Solution
Specify a new WebDriver BiDi command
emulation.setClientHintsUserAgentOverride:Alternative solution
Extend existing
emulation.setUserAgentOverridecommand: