-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.d.ts
59 lines (56 loc) · 2.56 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
51
52
53
54
55
56
57
58
59
import type { Builder, WebDriver } from 'selenium-webdriver';
import type { FingerprintPlugin } from 'browser-with-fingerprints';
/**
* Launcher options that only apply to the browser when using the `launch` method.
*/
export type LaunchOptions = {
/**
* An instance of the builder that will be used to launch the browser.
*/
builder?: Builder;
};
/**
* 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/Builder.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.
*
* You must specify the service key to apply the fingerprint when launching the browser (if the fingerprint was obtained using a paid key).
*
* @example
* An example of launching the browser in visible mode:
*
* ```js
* const driver = await plugin.launch({
* builder: new webdriver.Builder().setAlertBehavior('ignore'),
* });
* ```
*
* @param options - Set of configurable options to set on the browser.
* @returns Promise which resolves to a browser instance.
*/
launch(options?: LaunchOptions): 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;