### Complete Project Setup and Usage Example Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md A full example demonstrating the entire process: importing the library, setting the service key, fetching and applying a fingerprint, launching the browser, navigating to a URL, executing a script to get viewport size, and quitting the driver. Initial runs may be slow due to browser downloads. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); (async () => { // Get a fingerprint from the server: const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); // Apply fingerprint: plugin.useFingerprint(fingerprint); // Launch the browser instance: const driver = await plugin.launch(); // The rest of the code is the same as for a standard `selenium` library: await driver.get('https://example.com'); // Print the browser viewport size: console.log( 'Viewport:', await driver.executeScript(() => ({ deviceScaleFactor: window.devicePixelRatio, width: document.documentElement.clientWidth, height: document.documentElement.clientHeight, })) ); await driver.quit(); })(); ``` -------------------------------- ### Install selenium-with-fingerprints Plugin Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Install the plugin using npm, pnpm, or yarn. Ensure selenium-webdriver is also installed. ```bash npm i selenium-with-fingerprints # or pnpm i selenium-with-fingerprints # or yarn add selenium-with-fingerprints ``` ```bash npm i selenium-webdriver ``` -------------------------------- ### plugin.spawn Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Launches a browser instance with specified options. This method is used to start a new browser session. ```APIDOC ## plugin.spawn(options?) ### Description Launches a browser instance with given arguments and options when specified. ### Method `plugin.spawn` ### Parameters #### Query Parameters - **options** (Options)? - Launcher options that only apply to the browser when using the `spawn` method. ### Response #### Success Response (200) - **Promise** - Promise which resolves to a browser instance. ``` -------------------------------- ### Standard Selenium Project Setup Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Example of a basic Selenium project without fingerprint support. This code verifies canvas signature, which remains consistent across runs on the same machine. ```javascript /* Without fingerprints */ const { until, Builder, By } = require('selenium-webdriver'); (async () => { const driver = await new Builder().forBrowser('chrome').build(); await driver.get('https://browserleaks.com/canvas'); const el = await driver.wait(until.elementLocated(By.id('crc'))); await driver.wait(until.elementTextContains(el, '✔')); console.log('Canvas signature:', await el.getText()); await driver.quit(); })(); ``` -------------------------------- ### Launch Browser with Proxy and Fingerprint Settings Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Queue a proxy using `plugin.useProxy` before launching the browser with `plugin.launch`. This method supports various proxy formats and optional timezone/geolocation adjustments. The example demonstrates how to detect the external IP address through the proxy. ```javascript require('chromedriver'); const { Builder, until, By } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); // Supported proxy formats: // '127.0.0.1:8080' // 'https://127.0.0.1:8080' // 'socks5://127.0.0.1:9050' // 'username:password@127.0.0.1:8080' plugin.useProxy('socks5://127.0.0.1:9762', { changeTimezone: true, // Adjust browser timezone to match proxy location changeGeolocation: true, // Adjust browser geolocation to match proxy location detectExternalIP: false, // Skip automatic external IP detection }); const driver = await plugin.launch({ builder: new Builder().setChromeOptions(new Options().addArguments(['--headless'])), }); await driver.get('https://canhazip.com/'); const pre = await driver.wait(until.elementLocated(By.css('pre'))); console.log('External IP via proxy:', await pre.getText()); await driver.quit(); ``` -------------------------------- ### Configure Plugin Working Folder Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the global directory where the plugin engine will be installed. Defaults to './data'. ```javascript // Set the folder where the plugin engine will be installed: plugin.setWorkingFolder('./engine'); ``` -------------------------------- ### Spawn Browser Instance Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Starts a browser process without connecting to it for automation, returning a running instance. Useful for manual connection later. Requires 'Builder', 'Options' from 'selenium-webdriver', and 'plugin' from 'selenium-with-fingerprints'. ```javascript const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); const chrome = await plugin.spawn({ headless: true }); const driver = await new Builder() .forBrowser('chrome') .setChromeOptions(new Options().debuggerAddress(`localhost:${chrome.port}`)) .build(); await driver.quit(); await chrome.close(); ``` -------------------------------- ### Configure Plugin Global Settings Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Control the engine installation directory and network timeouts using `plugin.setWorkingFolder`, `plugin.setRequestTimeout`, and `plugin.setEngineTimeout`. These settings apply globally to all plugin instances. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Store the engine in a custom directory (useful for worker thread isolation): plugin.setWorkingFolder('./engine'); // Timeout (ms) for fingerprint fetch/apply requests (default: 300000): plugin.setRequestTimeout(5 * 60_000); // Timeout (ms) for engine download/installation (default: 600000): plugin.setEngineTimeout(10 * 60_000); ``` -------------------------------- ### plugin.spawn(options?) Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Starts the bundled browser process without connecting to it for automation, returning a `Browser` object with a `port` property. Useful when you need to manually attach an existing Selenium session or connect via remote debugger address. ```APIDOC ## `plugin.spawn(options?)` ### Description Starts the bundled browser process without connecting to it for automation, returning a `Browser` object with a `port` property. Useful when you need to manually attach an existing Selenium session or connect via remote debugger address. ### Method `plugin.spawn(options?)` ### Parameters #### Options - **headless** (boolean) - Optional - If true, the browser will run in headless mode. ### Request Example ```javascript const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); // Spawn the browser process (fingerprint/proxy already queued if needed): const chrome = await plugin.spawn({ headless: true }); // Connect to the spawned process via debugger address: const driver = await new Builder() .forBrowser('chrome') .setChromeOptions(new Options().debuggerAddress(`localhost:${chrome.port}`)) .build(); await driver.get('https://example.com'); await driver.quit(); await chrome.close(); ``` ``` -------------------------------- ### Global Configuration Methods Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Global configuration methods that control the engine installation directory and network timeouts. These settings affect all plugin instances. ```APIDOC ## Global Configuration Methods ### `plugin.setWorkingFolder(folder)` Sets the engine installation directory. Useful for worker thread isolation. ### `plugin.setRequestTimeout(ms)` Sets the timeout (in milliseconds) for fingerprint fetch/apply requests. Default is 300000ms. ### `plugin.setEngineTimeout(ms)` Sets the timeout (in milliseconds) for engine download/installation. Default is 600000ms. ### Request Example ```javascript const { plugin } = require('selenium-with-fingerprints'); // Store the engine in a custom directory (useful for worker thread isolation): plugin.setWorkingFolder('./engine'); // Timeout (ms) for fingerprint fetch/apply requests (default: 300000): plugin.setRequestTimeout(5 * 60_000); // Timeout (ms) for engine download/installation (default: 600000): plugin.setEngineTimeout(10 * 60_000); ``` ``` -------------------------------- ### Set Service Key and Fetch Fingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Configure the service key for the plugin and fetch a fingerprint based on specified tags. Leave the service key empty to use the free version. This setup is required before applying fingerprint configurations. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); plugin.useProxy('127.0.0.1:8080').useFingerprint(fingerprint); ``` -------------------------------- ### Install Chromedriver Dependency Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Install the required chromedriver version compatible with the plugin. Use the current supported engine version number if unsure. ```bash npm i chromedriver@132.0.1 ``` -------------------------------- ### Configure Plugin Engine Timeout Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the global timeout in milliseconds for installing or downloading the engine. Defaults to 600000ms. ```javascript // Set the timeout used when installing/downloading engine: plugin.setEngineTimeout(10 * 60000); ``` -------------------------------- ### Spawn Browser Process with Selenium Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Use `plugin.spawn` to start a browser process independently. Connect to it using Selenium's `debuggerAddress` option. Ensure the spawned browser is closed with `chrome.close()`. ```javascript const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); // Spawn the browser process (fingerprint/proxy already queued if needed): const chrome = await plugin.spawn({ headless: true }); // Connect to the spawned process via debugger address: const driver = await new Builder() .forBrowser('chrome') .setChromeOptions(new Options().debuggerAddress(`localhost:${chrome.port}`)) .build(); await driver.get('https://example.com'); await driver.quit(); await chrome.close(); ``` -------------------------------- ### Set Service Key and Use Fingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the service key and applies a fetched fingerprint with specific options. Ensure the service key is set before fetching or using fingerprints. Note that `safeBattery` is disabled by default in this example. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); plugin.useFingerprint(fingerprint, { // It's disabled by default. safeElementSize: true, // It's enabled by default. safeBattery: false, }); ``` -------------------------------- ### Configure Browser Version Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Set a specific browser version or use the 'default' value to select the latest available version. This configuration applies only to the current plugin instance and will throw an error if an invalid version is specified upon browser start. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Use a specific version: plugin.useBrowserVersion('128.0.6613.85'); // Use the latest available version: plugin.useBrowserVersion('default'); ``` -------------------------------- ### Configure Proxy with Options Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Use the `useProxy` method to set up a proxy. Additional options like changing timezone and geolocation can be applied. ```javascript const { plugin } = require('selenium-with-fingerprints'); plugin.useProxy('127.0.0.1:8080', { // Change browser timezone according to proxy: changeTimezone: true, // Replace browser geolocation according to proxy: changeGeolocation: true, }); ``` -------------------------------- ### Launch Browser with Proxy via Arguments Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Integrate proxy settings directly into browser launch arguments using `--proxy-server`. This method is less flexible than `useProxy` for additional options. ```javascript const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); const options = new Options().addArguments( // The syntax for specifying an argument value // is exactly the same as for using a separate method. '--proxy-server=https://127.0.0.1:8080' ); const browser = await plugin.launch({ builder: new Builder().setChromeOptions(options) }); ``` -------------------------------- ### plugin.launch Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Launches Selenium and a browser instance with specified arguments and options. ```APIDOC ## plugin.launch(options?) ### Description Launches **selenium** and launches a browser instance with given arguments and options when specified. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `options` (LaunchOptions)? - Set of configurable options to set on the browser. ### Response #### Success Response (200) * `Promise` - Promise which resolves to a browser instance. #### Response Example None provided. ``` -------------------------------- ### Apply Fingerprint and Launch Browser Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Apply the fetched fingerprint using `plugin.useFingerprint()` and then launch the browser instance with `plugin.launch()`. The launch method accepts the same parameters as the selenium-webdriver Builder.build method. ```javascript plugin.useFingerprint(fingerprint); const driver = await plugin.launch(); ``` -------------------------------- ### Selenium Project with Fingerprint Integration Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Demonstrates how to integrate `selenium-with-fingerprints` into an existing Selenium project. It includes setting a service key, fetching a fingerprint, applying it, and launching the browser using `plugin.launch`. ```javascript /* With fingerprints */ // Import `selenium-with-fingerprints` instead of `selenium-webdriver` // const { Builder } = require('selenium-webdriver'); const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); (async () => { // Obtain a fingerprint from the server. The resulting variable contains a string - it can be stored for later use: const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); // Apply fingerprint - after calling the `useFingerprint` method, the browser will be launched with a fingerprint: plugin.useFingerprint(fingerprint); // Replace `builder.build` method call with `plugin.launch`: // const driver = await new Builder().forBrowser('chrome').build(); const driver = await plugin.launch({ builder: new Builder().forBrowser('chrome') }); // The rest of the code is the same as for the standard `selenium` library: await driver.get('https://browserleaks.com/canvas'); const el = await driver.wait(until.elementLocated(By.id('crc'))); await driver.wait(until.elementTextContains(el, '✔')); console.log('Canvas signature:', await el.getText()); await driver.quit(); })(); ``` -------------------------------- ### plugin.useProxy(value?, options?) Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Queues a proxy to be applied on the next browser launch. Supports `https` and `socks5` protocols, with or without authentication. Optional second argument enables automatic timezone and geolocation adjustment to match the proxy's exit node. ```APIDOC ## `plugin.useProxy(value?, options?)` ### Description Queues a proxy to be applied on the next browser launch. Supports `https` and `socks5` protocols, with or without authentication. Optional second argument enables automatic timezone and geolocation adjustment to match the proxy's exit node. Returns `this` for chaining. ### Method `plugin.useProxy(value?, options?)` ### Parameters #### Value - **value** (string) - Optional - The proxy server address (e.g., 'socks5://127.0.0.1:9050', 'username:password@127.0.0.1:8080'). #### Options - **changeTimezone** (boolean) - Optional - Adjust browser timezone to match proxy location. - **changeGeolocation** (boolean) - Optional - Adjust browser geolocation to match proxy location. - **detectExternalIP** (boolean) - Optional - Skip automatic external IP detection. ### Request Example ```javascript require('chromedriver'); const { Builder, until, By } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); // Supported proxy formats: // '127.0.0.1:8080' // 'https://127.0.0.1:8080' // 'socks5://127.0.0.1:9050' // 'username:password@127.0.0.1:8080' plugin.useProxy('socks5://127.0.0.1:9762', { changeTimezone: true, // Adjust browser timezone to match proxy location changeGeolocation: true, // Adjust browser geolocation to match proxy location detectExternalIP: false, // Skip automatic external IP detection }); const driver = await plugin.launch({ builder: new Builder().setChromeOptions(new Options().addArguments(['--headless'])), }); await driver.get('https://canhazip.com/'); const pre = await driver.wait(until.elementLocated(By.css('pre'))); console.log('External IP via proxy:', await pre.getText()); await driver.quit(); ``` ``` -------------------------------- ### plugin.useBrowserVersion(version) Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Selects a specific bundled Chromium build to use for the next launch. Use `'default'` for the latest available version. Call `plugin.versions()` to enumerate all available builds. ```APIDOC ## `plugin.useBrowserVersion(version)` ### Description Selects a specific bundled Chromium build to use for the next launch. Use `'default'` for the latest available version. Call `plugin.versions()` to enumerate all available builds. ### Method `plugin.useBrowserVersion(version)` ### Parameters #### Version - **version** (string) - Required - The browser version to use (e.g., '128.0.6613.85', 'default'). ### Request Example ```javascript const { plugin } = require('selenium-with-fingerprints'); // List available versions with extended metadata: const versions = await plugin.versions('extended'); console.log('Available versions:', versions.map((v) => v.browser_version)); // Pin to a specific build: plugin.useBrowserVersion('128.0.6613.85'); // Or always use the latest: plugin.useBrowserVersion('default'); const driver = await plugin.launch(); await driver.quit(); ``` ``` -------------------------------- ### plugin.useProfile(value?, options?) Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Queues a browser profile directory to be used on the next launch. Fingerprint and proxy data stored in the profile folder can optionally be auto-loaded. Returns `this` for chaining. ```APIDOC ## `plugin.useProfile(value?, options?)` ### Description Queues a browser profile directory to be used on the next launch. Fingerprint and proxy data stored in the profile folder can optionally be auto-loaded. Returns `this` for chaining. ### Method `plugin.useProfile(value?, options?)` ### Parameters #### Value - **value** (string) - Optional - The path to the browser profile directory. #### Options - **loadFingerprint** (boolean) - Optional - Load fingerprint stored in the profile (default: true). - **loadProxy** (boolean) - Optional - Skip loading proxy from the profile. ### Request Example ```javascript const path = require('path'); const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); plugin.setServiceKey(''); // Use a persistent profile; load fingerprint/proxy from it if previously saved: plugin.useProfile(path.resolve('./my-profile'), { loadFingerprint: true, // Load fingerprint stored in the profile (default: true) loadProxy: false, // Skip loading proxy from the profile }); // Alternatively, pass the profile via Chrome arguments: const driver = await plugin.launch({ builder: new Builder().setChromeOptions( new Options().addArguments([`--user-data-dir=${path.resolve('./my-profile')}`]) ), }); await driver.get('chrome://version'); await driver.quit(); ``` ``` -------------------------------- ### Launch Browser with User Data Directory Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Launch a browser instance using a specified user data directory, which can be used as a profile path. This approach is suitable when you only need to set the profile directory and do not require additional fingerprint or proxy loading configurations from the profile. ```javascript const path = require('path'); const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); const options = new Options().addArguments( // Browser arguments can be used as well: `--user-data-dir=${path.resolve('./profile')}` ); const browser = await plugin.launch({ builder: new Builder().setChromeOptions(options) }); ``` -------------------------------- ### Set Service Key and Fetch Fingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Configure the service key for the plugin. Use an empty string for the free version. Then, fetch a fingerprint matching the specified tags (e.g., OS and browser). ```javascript // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); ``` -------------------------------- ### Launch Browser with Fingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Launches a new browser instance with the specified parameters, allowing for fingerprint and proxy customization. Requires the 'Builder' and 'plugin' from 'selenium-with-fingerprints'. ```javascript const { plugin } = require('selenium-with-fingerprints'); const browser = await plugin.launch({ builder: new Builder() }); ``` -------------------------------- ### Import selenium-with-fingerprints Library Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Import the necessary 'plugin' object from the 'selenium-with-fingerprints' library. No need to import 'selenium-webdriver' separately. ```javascript const { plugin } = require('selenium-with-fingerprints'); ``` -------------------------------- ### Select Specific Browser Version Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Use `plugin.useBrowserVersion` to specify a Chromium build for launching. Set to `'default'` for the latest version. `plugin.versions('extended')` can list available builds with metadata. ```javascript const { plugin } = require('selenium-with-fingerprints'); // List available versions with extended metadata: const versions = await plugin.versions('extended'); console.log('Available versions:', versions.map((v) => v.browser_version)); // Pin to a specific build: plugin.useBrowserVersion('128.0.6613.85'); // Or always use the latest: plugin.useBrowserVersion('default'); const driver = await plugin.launch(); await driver.quit(); ``` -------------------------------- ### Launch Browser with Temporary Profile Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Launch a browser instance without specifying a profile path. The engine will automatically create and manage a temporary profile located within the engine's folder. This is the default behavior when no explicit profile path is provided. ```javascript const { plugin } = require('selenium-with-fingerprints'); // The profile will be located in the `data/profiles/UNIQUE_ID` folder: const browser = await plugin.launch(); ``` -------------------------------- ### Launch Multiple Independent Browser Sessions in Parallel Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Use `Promise.all` to launch multiple independent browser sessions concurrently. Each session requires a separate `fetch` and `launch` call. ```javascript require('chromedriver'); const { plugin } = require('selenium-with-fingerprints'); plugin.setServiceKey(''); async function launchSession(id) { const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'] }); const driver = await plugin.useFingerprint(fingerprint).launch(); await driver.get('https://browserleaks.com/javascript'); // ... scrape data ... const userAgent = await driver.executeScript(() => navigator.userAgent); await driver.quit(); return { id, userAgent }; } // Launch 3 independent browser sessions in parallel: const results = await Promise.all([1, 2, 3].map(launchSession)); console.log(results); // Expected: 3 entries, each with a distinct userAgent string ``` -------------------------------- ### plugin.versions Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Retrieves a list of all available browser versions. The format of the returned result can be specified. ```APIDOC ## plugin.versions(format?) ### Description Get a list of all available browser versions. ### Method `plugin.versions` ### Parameters #### Query Parameters - **format** (string)? - The output format of the returned result. ### Response #### Success Response (200) - **Promise** - The list of objects with detailed version information, or a list of strings. ``` -------------------------------- ### plugin.useProfile Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the profile settings using the specified profile and additional options. ```APIDOC ## plugin.useProfile(value?, options?) ### Description Set the profile settings using the specified profile as a string and additional options when specified. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `value` (string)? - Profile value as a string. * `options` (ProfileOptions)? - Set of configurable options for applying a profile. ### Response #### Success Response (200) * `this` - The same plugin instance with an updated settings (for optional chaining). #### Response Example None provided. ``` -------------------------------- ### Use Custom Tags with Premium Key Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Demonstrates fetching a fingerprint with custom tags ('Android', 'Chrome') which requires a premium service key. The fetched fingerprint is then applied, and the browser is launched. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). plugin.setServiceKey('SERVICE_KEY'); // In order to use custom tags you need the premium key: const fingerprint = await plugin.fetch({ tags: ['Android', 'Chrome'], }); plugin.useFingerprint(fingerprint); await plugin.launch(); ``` -------------------------------- ### plugin.useProxy Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the proxy settings using the specified proxy and additional options. ```APIDOC ## plugin.useProxy(value?, options?) ### Description Set the proxy settings using the specified proxy as a string and additional options when specified. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `value` (string)? - Proxy value as a string. * `options` (ProxyOptions)? - Set of configurable options for applying a proxy. ### Response #### Success Response (200) * `this` - The same plugin instance with an updated settings (for optional chaining). #### Response Example None provided. ``` -------------------------------- ### plugin.fetch Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Obtains a fingerprint using the specified service key and additional options. ```APIDOC ## plugin.fetch(options?) ### Description Obtain a fingerprint using the specified service key and additional options. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `options` (FetchOptions)? - Set of configurable options for getting a browser fingerprint. ### Response #### Success Response (200) * `Promise` - Promise which resolves to a fingerprint string. #### Response Example None provided. ``` -------------------------------- ### Use Persistent Browser Profile with Fingerprints Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt Configure `plugin.useProfile` to load settings from a specified directory, optionally including fingerprint and proxy data. Alternatively, pass the profile directory via Chrome arguments using `--user-data-dir`. ```javascript const path = require('path'); const { Builder } = require('selenium-webdriver'); const { Options } = require('selenium-webdriver/chrome'); const { plugin } = require('selenium-with-fingerprints'); plugin.setServiceKey(''); // Use a persistent profile; load fingerprint/proxy from it if previously saved: plugin.useProfile(path.resolve('./my-profile'), { loadFingerprint: true, // Load fingerprint stored in the profile (default: true) loadProxy: false, // Skip loading proxy from the profile }); // Alternatively, pass the profile via Chrome arguments: const driver = await plugin.launch({ builder: new Builder().setChromeOptions( new Options().addArguments([`--user-data-dir=${path.resolve('./my-profile')}`]) ), }); await driver.get('chrome://version'); await driver.quit(); ``` -------------------------------- ### Fetch and Use Latest Browser Version Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Retrieve a list of available browser versions in extended format and then use the latest version for the browser. The list of versions is always sorted in descending order. ```javascript const { plugin } = require('selenium-with-fingerprints'); // The list of versions is always sorted in descending order: await plugin.versions('extended').then((versions) => { // The latest available browser version will be used: plugin.useBrowserVersion(versions[0]['browser_version']); }); ``` -------------------------------- ### Set Environment Variables for Fingerprint Service and Proxy Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/examples/README.md Configure the fingerprint service key and proxy settings using environment variables. These can be set directly or via a .env file. ```shell FINGERPRINT_KEY="SERVICE_KEY" FINGERPRINT_PROXY="socks5://127.0.0.1:9762" ``` -------------------------------- ### Save and Reuse Fingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Shows how to save a fetched fingerprint to a file and then load it for reuse in subsequent browser launches. This can significantly speed up the startup process. Requires 'fs/promises' for file operations. ```javascript const { readFile, writeFile } = require('fs/promises'); const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); // Save the fingerprint to a file: const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], }); await writeFile('fingerprint.json', fingerprint); // Load fingerprint from file at next run: plugin.useFingerprint(await readFile('fingerprint.json', 'utf8')); ``` -------------------------------- ### Free Version Fingerprint Fetch Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Illustrates fetching a fingerprint using the free version of the service. Only default tags like 'Microsoft Windows' and 'Chrome' are allowed, and certain filters are unavailable. ```javascript // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); const fingerprint = await plugin.fetch({ // You can only use these tags with the free version: tags: ['Microsoft Windows', 'Chrome'], // You also cannot use such filters in the free version: // minBrowserVersion: 130, }); ``` -------------------------------- ### Use Specific Browser Profile with Fingerprints Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Use the `useProfile` method to specify a browser profile path and control loading of fingerprint and proxy data. Set `loadFingerprint` and `loadProxy` to `false` to prevent loading from the profile folder. This method is useful when you need to manage specific browser states or configurations. ```javascript const path = require('path'); const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); // The key may be required if the fingerprint will be used from the profile. plugin.useProfile(path.resolve('./profile'), { // Don't load fingerprint from profile folder: loadFingerprint: false, // Don't load proxy from profile folder: loadProxy: false, }); ``` -------------------------------- ### Fetch Fingerprint with Filters Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Fetches a fingerprint using specific tags and applies filters for browser version and collection time. A service key is required for advanced filtering. The `timeLimit` can be specified in various formats like '15 days'. ```javascript const { plugin } = require('selenium-with-fingerprints'); // Set the service key for the plugin (you can buy it here https://bablosoft.com/directbuy/FingerprintSwitcher/2). // Leave an empty string to use the free version. plugin.setServiceKey(''); const fingerprint = await plugin.fetch({ tags: ['Microsoft Windows', 'Chrome'], // Fetch fingerprints only with a browser version higher than 130: minBrowserVersion: 130, // Fetch fingerprints only with a browser version lower than 132: maxBrowserVersion: 132, // Fetch fingerprints only collected in the last 15 days: timeLimit: '15 days', }); ``` -------------------------------- ### plugin.useFingerprint Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the fingerprint settings using the specified fingerprint and additional options. ```APIDOC ## plugin.useFingerprint(value?, options?) ### Description Set the fingerprint settings using the specified fingerprint as a string and additional options when specified. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `value` (string)? - Fingerprint value as a string. * `options` (FingerprintOptions)? - Set of configurable options for applying a fingerprint. ### Response #### Success Response (200) * `this` - The same plugin instance with an updated settings (for optional chaining). #### Response Example None provided. ``` -------------------------------- ### Import Chromedriver Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Add this import at the beginning of your code to ensure chromedriver is correctly set up for the plugin. ```javascript require('chromedriver'); ``` -------------------------------- ### plugin.setWorkingFolder Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the working folder that the plugin uses to work with the engine. ```APIDOC ## plugin.setWorkingFolder(folder) ### Description Set the working folder that the plugin uses to work with the engine. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `folder` (string) - The working folder that the plugin engine will use. ### Response #### Success Response (200) None explicitly documented. #### Response Example None provided. ``` -------------------------------- ### Integrate with Chrome DevTools Protocol (CDP) Source: https://context7.com/bablosoft/selenium-with-fingerprints/llms.txt The `WebDriver` instance supports `sendDevToolsCommand` and `sendAndGetDevToolsCommand` for direct CDP access. This allows for low-level control, such as retrieving or clearing cookies. ```javascript require('chromedriver'); const { plugin } = require('selenium-with-fingerprints'); const driver = await plugin.launch(); await driver.get('https://google.com'); await driver.findElement({ css: 'form[action]' }); // Retrieve all cookies across all domains via CDP: const { cookies } = await driver.sendAndGetDevToolsCommand('Storage.getCookies'); console.log('All cookies:', cookies); // Clear all cookies: await driver.sendDevToolsCommand('Storage.clearCookies'); await driver.quit(); ``` -------------------------------- ### plugin.useBrowserVersion Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the current browser version used by the plugin instance. ```APIDOC ## plugin.useBrowserVersion(version) ### Description Set the current browser version used by the plugin instance. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `version` (string) - Version value as a string. ### Response #### Success Response (200) * `this` - The same plugin instance with an updated settings (for optional chaining). #### Response Example None provided. ``` -------------------------------- ### Configure Plugin Service Key Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the service key globally for all plugin methods that require it. This is used for accessing fingerprint services. ```javascript // Set the fingerprint service key for all plugin methods that require it. plugin.setServiceKey('SERVICE_KEY'); ``` -------------------------------- ### Configure Plugin Request Timeout Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the global timeout in milliseconds for requests to the engine, used for fetching and applying fingerprints. Defaults to 300000ms. ```javascript // Set the timeout used when fetching fingerprints and so on: plugin.setRequestTimeout(5 * 60000); ``` -------------------------------- ### Set Custom Working Directory for Engine Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Use the FINGERPRINT_CWD environment variable to specify a custom directory for the engine. This is useful for managing plugin engines. ```properties FINGERPRINT_CWD="../plugin-engine" ``` -------------------------------- ### plugin.setServiceKey Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the fingerprint service key for all plugin methods that require it. ```APIDOC ## plugin.setServiceKey(key) ### Description Set the fingerprint service key for all plugin methods that require it. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `key` (string) - The service key for obtaining and applying a fingerprint. ### Response #### Success Response (200) None explicitly documented. #### Response Example None provided. ``` -------------------------------- ### Set Custom Timeout for Engine Methods Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Adjust the FINGERPRINT_TIMEOUT environment variable to change the default timeout for engine operations like applying or fetching fingerprints. The value is in milliseconds. ```properties FINGERPRINT_TIMEOUT=300000 ``` -------------------------------- ### Format Code for Issue Reports Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md When reporting issues, format your code using markdown tags to ensure clarity. Avoid including sensitive information like service keys or passwords. ```js // your code ``` -------------------------------- ### plugin.setEngineTimeout Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the timeout that the plugin uses when fetching the engine. ```APIDOC ## plugin.setEngineTimeout(timeout) ### Description Set the timeout that the plugin uses when fetching engine (pass `0` to disable it). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `timeout` (number) - The engine timeout that the plugin engine will use. ### Response #### Success Response (200) None explicitly documented. #### Response Example None provided. ``` -------------------------------- ### plugin.setRequestTimeout Source: https://github.com/bablosoft/selenium-with-fingerprints/blob/master/README.md Sets the timeout that the plugin uses when executing requests. ```APIDOC ## plugin.setRequestTimeout(timeout) ### Description Set the timeout that the plugin uses when executing requests (pass `0` to disable it). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * `timeout` (number) - The request timeout that the plugin engine will use. ### Response #### Success Response (200) None explicitly documented. #### Response Example None provided. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.