@skrillex1224/playwright-toolkit 2.1.224 → 2.1.225

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/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;
@@ -212,11 +220,15 @@ export interface HumanClickOptions {
212
220
  export interface HumanizeModule {
213
221
  initializeCursor(page: Page): Promise<void>;
214
222
  jitterMs(base: number, jitterPercent?: number): number;
223
+ humanMove(page: Page, target: string | { x: number; y: number } | ElementHandle | Locator): Promise<boolean>;
224
+ humanScroll(page: Page, target: string | ElementHandle | Locator, options?: Record<string, any>): Promise<{ element: ElementHandle | Locator | null; didScroll: boolean; restore?: (() => Promise<void>) | null }>;
215
225
  humanType(page: Page, selector: string, text: string, options?: HumanTypeOptions): Promise<void>;
216
- humanClick(page: Page, target: string | ElementHandle, options?: HumanClickOptions): Promise<void>;
226
+ humanClick(page: Page, target: string | ElementHandle | Locator | null | undefined, options?: HumanClickOptions): Promise<boolean>;
227
+ humanClear(page: Page, selector: string): Promise<void>;
217
228
  warmUpBrowsing(page: Page, baseDuration?: number): Promise<void>;
218
229
  simulateGaze(page: Page, baseDurationMs?: number): Promise<void>;
219
230
  randomSleep(baseMs: number, jitterPercent?: number): Promise<void>;
231
+ naturalScroll(page: Page, direction?: 'up' | 'down', distance?: number, baseSteps?: number): Promise<void>;
220
232
  }
221
233
 
222
234
  // =============================================================================
@@ -239,15 +251,21 @@ export interface AntiDetectApplyOptions {
239
251
  permissions?: string[];
240
252
  }
241
253
 
254
+ export interface FingerprintGeneratorRuntimeOptions {
255
+ locale?: string;
256
+ browserMajorVersion?: number;
257
+ device?: RuntimeDevice;
258
+ }
259
+
242
260
  export interface AntiDetectModule {
243
261
  getBaseConfig(): AntiDetectConfig;
244
- getFingerprintGeneratorOptions(): Record<string, any>;
245
- getLaunchArgs(): string[];
262
+ getFingerprintGeneratorOptions(options?: FingerprintGeneratorRuntimeOptions): Record<string, any>;
263
+ getLaunchArgs(options?: { locale?: string }): string[];
246
264
  getAdvancedLaunchArgs(): string[];
247
265
  applyContext(context: BrowserContext, options?: AntiDetectApplyOptions): Promise<void>;
248
266
  applyPage(page: Page, options?: AntiDetectApplyOptions): Promise<void>;
249
267
  syncViewportWithScreen(page: Page): Promise<void>;
250
- getTlsFingerprintOptions(userAgent?: string, acceptLanguage?: string): Record<string, any>;
268
+ getTlsFingerprintOptions(userAgent?: string, acceptLanguage?: string, options?: FingerprintGeneratorRuntimeOptions): Record<string, any>;
251
269
  applyLocaleHeaders(headers: Record<string, string>, acceptLanguage?: string): Record<string, string>;
252
270
  }
253
271
 
@@ -367,6 +385,7 @@ export interface UtilsModule {
367
385
 
368
386
  export interface RuntimeEnvState {
369
387
  actor: string;
388
+ device: RuntimeDevice;
370
389
  runtime: Record<string, any>;
371
390
  envId: string;
372
391
  query: string;
@@ -412,6 +431,7 @@ export interface RuntimeEnvModule {
412
431
  buildRuntimeEnvFromSnapshot(snapshot?: RuntimeEnvSnapshot, options?: { browserProfileCore?: Record<string, any> }): Record<string, any> | null;
413
432
  buildEnvPatchFromSnapshot(snapshot?: RuntimeEnvSnapshot, options?: { browserProfileCore?: Record<string, any> }): Record<string, any> | null;
414
433
  mergeEnvPatches(...patches: Array<Record<string, any> | null | undefined>): Record<string, any> | null;
434
+ normalizeDevice(value?: unknown, fallback?: RuntimeDevice): RuntimeDevice;
415
435
  hasLoginState(source?: Record<string, any>, actor?: string): boolean;
416
436
  rememberState(source?: Record<string, any>): RuntimeEnvState | null;
417
437
  peekRememberedState(): RuntimeEnvState | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skrillex1224/playwright-toolkit",
3
- "version": "2.1.224",
3
+ "version": "2.1.225",
4
4
  "description": "一个在 Apify/Crawlee Actor 中启用实时截图视图的实用工具库。",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",