-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.d.ts
50 lines (48 loc) · 2.36 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { Builder, WebDriver } from 'selenium-webdriver';
import type { FingerprintPlugin } from 'browser-with-fingerprints';
/**
* Describes a plugin that is capable of fetching a fingerprint and launching a browser instance using it.
*
* @remarks
* **NOTE**: This plugin works correctly only with the **selenium** framework.
*/
export interface SeleniumFingerprintPlugin extends FingerprintPlugin {
/**
* Launches **selenium** and launches a browser instance with given arguments and options when specified.
*
* This method uses the selenium's native {@link Builder.build | build} method under the hood and adds some functionality for applying fingerprints and proxies.
* Before launching, the parameters that you specified using the {@link useProxy} and {@link useFingerprint} methods will also be applied for the browser.
*
* If you need more information on how the native method works, use the **selenium** documentation for the
* [builder](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_Builder.html)
* and
* [options](https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Options.html).
*
* @remarks
* **NOTE**: This plugin only works with the `chromium` browser, which comes bundled with the plugin.
* You will not be able to use default `chromium`, `firefox`, `webkit` and other engines that come with the **selenium** framework.
*
* If you need to use the default browsers without fingerprint spoofing, just use the **selenium** built-in methods.
*
* @example
* An example of launching the browser in visible mode:
*
* ```js
* const driver = await plugin.launch(
* new webdriver.Builder().setAlertBehavior('ignore')
* );
* ```
*
* @param builder - An instance of the builder that will be used to launch the browser.
* @returns Promise which resolves to a browser instance.
*/
launch(builder?: Builder): Promise<WebDriver>;
}
/**
* A default instance of the fingerprint plugin for the **selenium** library.
* It comes with a pre-configured launcher and is the easiest option to use.
*
* The default instance itself imports and uses the necessary dependencies, so you can replace
* the **selenium** imports with a plugin if you don't need additional options.
*/
export declare const plugin: SeleniumFingerprintPlugin;