@skrillex1224/playwright-toolkit 2.1.224 → 2.1.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/dist/browser.js +43 -3
- package/dist/browser.js.map +2 -2
- package/dist/index.cjs +1040 -147
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +1040 -147
- package/dist/index.js.map +4 -4
- package/index.d.ts +29 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page, BrowserContext, Browser, ElementHandle, Response } from 'playwright';
|
|
1
|
+
import type { Page, BrowserContext, Browser, ElementHandle, Locator, Response } from 'playwright';
|
|
2
2
|
|
|
3
3
|
// =============================================================================
|
|
4
4
|
// Constants
|
|
@@ -22,9 +22,16 @@ export interface ConstantsModule {
|
|
|
22
22
|
Code: CodeType;
|
|
23
23
|
Status: StatusType;
|
|
24
24
|
PresetOfLiveViewKey: string;
|
|
25
|
+
Device: {
|
|
26
|
+
Desktop: 'desktop';
|
|
27
|
+
Mobile: 'mobile';
|
|
28
|
+
};
|
|
29
|
+
normalizeDevice(value?: unknown, fallback?: RuntimeDevice): RuntimeDevice;
|
|
25
30
|
ActorInfo: Record<string, ActorInfoItem>;
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
export type RuntimeDevice = 'desktop' | 'mobile';
|
|
34
|
+
|
|
28
35
|
export interface ActorShareInfo {
|
|
29
36
|
mode: 'dom' | 'response';
|
|
30
37
|
prefix: string;
|
|
@@ -36,6 +43,7 @@ export interface ActorInfoItem {
|
|
|
36
43
|
name: string;
|
|
37
44
|
icon: string;
|
|
38
45
|
domain: string;
|
|
46
|
+
device: RuntimeDevice;
|
|
39
47
|
protocol: string;
|
|
40
48
|
path: string;
|
|
41
49
|
share: ActorShareInfo;
|
|
@@ -200,6 +208,8 @@ export interface ApifyKitModule {
|
|
|
200
208
|
export interface HumanTypeOptions {
|
|
201
209
|
baseDelay?: number;
|
|
202
210
|
jitterPercent?: number;
|
|
211
|
+
pauseProbability?: number;
|
|
212
|
+
pauseBase?: number;
|
|
203
213
|
}
|
|
204
214
|
|
|
205
215
|
export interface HumanClickOptions {
|
|
@@ -207,16 +217,22 @@ export interface HumanClickOptions {
|
|
|
207
217
|
jitterPercent?: number;
|
|
208
218
|
throwOnMissing?: boolean;
|
|
209
219
|
scrollIfNeeded?: boolean;
|
|
220
|
+
restore?: boolean;
|
|
210
221
|
}
|
|
211
222
|
|
|
212
223
|
export interface HumanizeModule {
|
|
213
224
|
initializeCursor(page: Page): Promise<void>;
|
|
214
225
|
jitterMs(base: number, jitterPercent?: number): number;
|
|
226
|
+
humanMove(page: Page, target: string | { x: number; y: number } | ElementHandle | Locator): Promise<boolean>;
|
|
227
|
+
humanScroll(page: Page, target: string | ElementHandle | Locator, options?: Record<string, any>): Promise<{ element: ElementHandle | Locator | null; didScroll: boolean; restore?: (() => Promise<void>) | null }>;
|
|
215
228
|
humanType(page: Page, selector: string, text: string, options?: HumanTypeOptions): Promise<void>;
|
|
216
|
-
humanClick(page: Page, target: string | ElementHandle, options?: HumanClickOptions): Promise<
|
|
229
|
+
humanClick(page: Page, target: string | ElementHandle | Locator | null | undefined, options?: HumanClickOptions): Promise<boolean>;
|
|
230
|
+
humanClear(page: Page, selector: string): Promise<void>;
|
|
217
231
|
warmUpBrowsing(page: Page, baseDuration?: number): Promise<void>;
|
|
218
232
|
simulateGaze(page: Page, baseDurationMs?: number): Promise<void>;
|
|
233
|
+
randomSleep(page: Page, baseMs: number, jitterPercent?: number): Promise<void>;
|
|
219
234
|
randomSleep(baseMs: number, jitterPercent?: number): Promise<void>;
|
|
235
|
+
naturalScroll(page: Page, direction?: 'up' | 'down', distance?: number, baseSteps?: number): Promise<void>;
|
|
220
236
|
}
|
|
221
237
|
|
|
222
238
|
// =============================================================================
|
|
@@ -239,15 +255,21 @@ export interface AntiDetectApplyOptions {
|
|
|
239
255
|
permissions?: string[];
|
|
240
256
|
}
|
|
241
257
|
|
|
258
|
+
export interface FingerprintGeneratorRuntimeOptions {
|
|
259
|
+
locale?: string;
|
|
260
|
+
browserMajorVersion?: number;
|
|
261
|
+
device?: RuntimeDevice;
|
|
262
|
+
}
|
|
263
|
+
|
|
242
264
|
export interface AntiDetectModule {
|
|
243
265
|
getBaseConfig(): AntiDetectConfig;
|
|
244
|
-
getFingerprintGeneratorOptions(): Record<string, any>;
|
|
245
|
-
getLaunchArgs(): string[];
|
|
266
|
+
getFingerprintGeneratorOptions(options?: FingerprintGeneratorRuntimeOptions): Record<string, any>;
|
|
267
|
+
getLaunchArgs(options?: { locale?: string }): string[];
|
|
246
268
|
getAdvancedLaunchArgs(): string[];
|
|
247
269
|
applyContext(context: BrowserContext, options?: AntiDetectApplyOptions): Promise<void>;
|
|
248
270
|
applyPage(page: Page, options?: AntiDetectApplyOptions): Promise<void>;
|
|
249
271
|
syncViewportWithScreen(page: Page): Promise<void>;
|
|
250
|
-
getTlsFingerprintOptions(userAgent?: string, acceptLanguage?: string): Record<string, any>;
|
|
272
|
+
getTlsFingerprintOptions(userAgent?: string, acceptLanguage?: string, options?: FingerprintGeneratorRuntimeOptions): Record<string, any>;
|
|
251
273
|
applyLocaleHeaders(headers: Record<string, string>, acceptLanguage?: string): Record<string, string>;
|
|
252
274
|
}
|
|
253
275
|
|
|
@@ -367,6 +389,7 @@ export interface UtilsModule {
|
|
|
367
389
|
|
|
368
390
|
export interface RuntimeEnvState {
|
|
369
391
|
actor: string;
|
|
392
|
+
device: RuntimeDevice;
|
|
370
393
|
runtime: Record<string, any>;
|
|
371
394
|
envId: string;
|
|
372
395
|
query: string;
|
|
@@ -412,6 +435,7 @@ export interface RuntimeEnvModule {
|
|
|
412
435
|
buildRuntimeEnvFromSnapshot(snapshot?: RuntimeEnvSnapshot, options?: { browserProfileCore?: Record<string, any> }): Record<string, any> | null;
|
|
413
436
|
buildEnvPatchFromSnapshot(snapshot?: RuntimeEnvSnapshot, options?: { browserProfileCore?: Record<string, any> }): Record<string, any> | null;
|
|
414
437
|
mergeEnvPatches(...patches: Array<Record<string, any> | null | undefined>): Record<string, any> | null;
|
|
438
|
+
normalizeDevice(value?: unknown, fallback?: RuntimeDevice): RuntimeDevice;
|
|
415
439
|
hasLoginState(source?: Record<string, any>, actor?: string): boolean;
|
|
416
440
|
rememberState(source?: Record<string, any>): RuntimeEnvState | null;
|
|
417
441
|
peekRememberedState(): RuntimeEnvState | null;
|