setUserAgentOverride method

Future<void> setUserAgentOverride(
  1. String userAgent, {
  2. String? acceptLanguage,
  3. String? platform,
  4. UserAgentMetadata? userAgentMetadata,
})

Allows overriding user agent with the given string. userAgent User agent to use. acceptLanguage Browser langugage to emulate. platform The platform navigator.platform should return. userAgentMetadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData

Implementation

Future<void> setUserAgentOverride(String userAgent,
    {String? acceptLanguage,
    String? platform,
    emulation.UserAgentMetadata? userAgentMetadata}) async {
  await _client.send('Network.setUserAgentOverride', {
    'userAgent': userAgent,
    if (acceptLanguage != null) 'acceptLanguage': acceptLanguage,
    if (platform != null) 'platform': platform,
    if (userAgentMetadata != null) 'userAgentMetadata': userAgentMetadata,
  });
}