BrowserEmulators are a special class of core plugins that help SecretAgent disguise itself as different browsers.
The biggest difference that BrowserEmulators have over standard CorePlugins is that only a single instance is ever run within a session -- i.e. you cannot use two BrowserEmulators within the same session. In addition, the Browser Emulator is always run before any standard Core Plugins, and as such, the Browser Emulator is responsible for choosing which browser engine to use (i.e., Chrome 88 vs Chrome 91).
ADVICE: Unless you have access to the exact data that a browser resembles, it's recommended that you extend @secret-agent/default-browser-emulator
with additional overrides.
BrowserEmulators have all the same class properties as core plugins, with one significant change, the type property must always be set to CorePlugin:BrowserEmulator
instead of just CorePlugin
:
This tells SecretAgent the plugin is a special BrowserEmulator.
string
. This must always be set to 'CorePlugin:BrowserEmulator'
.BrowserEmulators require a method that receives a userAgentSelector and returns browser engine meta (user agent details + browser engine).
See @secret-agent/default-browser-emulator for an implementation example.
SelectBrowserMeta
This is called every time a new browser engine is started, which may not be every session. A single browser engine is used across multiple sessions through isolated tabs.
object
boolean
- has the user requested to show the browserboolean
- has the user requested to disable the gpuboolean
- has the user requested to disable automatically showing devtoolsBrowser Emulators require a few extra properties than standard Core Plugins. These are all related to the browser engine selected by the emulator. See @secret-agent/default-browser-emulator
for an implementation example.
string
.Version
.string
.string
.Version
.string
.