@@ -11,37 +11,51 @@ type WaitForSelectorOptionsNotHidden = PageWaitForSelectorOptions & {
11
11
visibility : 'visible' | 'any' ;
12
12
}
13
13
14
- export interface Page < C = BrowserContext > {
15
- context ( ) : C ;
14
+ type HTMLOrSVGElement = SVGElement | HTMLElement ;
15
+ type HTMLOrSVGElementHandle = ElementHandle < HTMLOrSVGElement > ;
16
16
17
+ export interface Page {
17
18
evaluate < Args extends any [ ] , R > ( pageFunction : PageFunction < Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
18
19
evaluateHandle < Args extends any [ ] , R > ( pageFunction : PageFunction < Args , R > , ...args : Boxed < Args > ) : Promise < Handle < R > > ;
19
20
20
21
$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > | null > ;
21
- $ ( selector : string ) : Promise < ElementHandle < Element > | null > ;
22
+ $ ( selector : string ) : Promise < HTMLOrSVGElementHandle | null > ;
23
+
24
+ $$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > [ ] > ;
25
+ $$ ( selector : string ) : Promise < HTMLOrSVGElementHandle [ ] > ;
22
26
23
27
$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
24
- $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
28
+ $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
25
29
26
30
$$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
27
- $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
31
+ $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
28
32
29
- waitForSelector ( selector : string , options ?: WaitForSelectorOptionsNotHidden ) : Promise < ElementHandle > ;
30
- waitForSelector ( selector : string , options : PageWaitForSelectorOptions ) : Promise < null | ElementHandle > ;
33
+ waitForSelector < K extends keyof HTMLElementTagNameMap > ( selector : K , options ?: WaitForSelectorOptionsNotHidden ) : Promise < ElementHandleForTag < K > > ;
34
+ waitForSelector ( selector : string , options ?: WaitForSelectorOptionsNotHidden ) : Promise < HTMLOrSVGElementHandle > ;
35
+ waitForSelector < K extends keyof HTMLElementTagNameMap > ( selector : K , options : PageWaitForSelectorOptions ) : Promise < ElementHandleForTag < K > | null > ;
36
+ waitForSelector ( selector : string , options : PageWaitForSelectorOptions ) : Promise < null | HTMLOrSVGElementHandle > ;
31
37
}
32
38
33
39
export interface Frame {
34
40
evaluate < Args extends any [ ] , R > ( pageFunction : PageFunction < Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
35
41
evaluateHandle < Args extends any [ ] , R > ( pageFunction : PageFunction < Args , R > , ...args : Boxed < Args > ) : Promise < Handle < R > > ;
36
42
37
43
$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > | null > ;
38
- $ ( selector : string ) : Promise < ElementHandle < Element > | null > ;
44
+ $ ( selector : string ) : Promise < HTMLOrSVGElementHandle | null > ;
45
+
46
+ $$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > [ ] > ;
47
+ $$ ( selector : string ) : Promise < HTMLOrSVGElementHandle [ ] > ;
39
48
40
49
$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
41
- $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
50
+ $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
42
51
43
52
$$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
44
- $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
53
+ $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
54
+
55
+ waitForSelector < K extends keyof HTMLElementTagNameMap > ( selector : K , options ?: WaitForSelectorOptionsNotHidden ) : Promise < ElementHandleForTag < K > > ;
56
+ waitForSelector ( selector : string , options ?: WaitForSelectorOptionsNotHidden ) : Promise < HTMLOrSVGElementHandle > ;
57
+ waitForSelector < K extends keyof HTMLElementTagNameMap > ( selector : K , options : PageWaitForSelectorOptions ) : Promise < ElementHandleForTag < K > | null > ;
58
+ waitForSelector ( selector : string , options : PageWaitForSelectorOptions ) : Promise < null | HTMLOrSVGElementHandle > ;
45
59
}
46
60
47
61
export interface Worker {
@@ -58,17 +72,16 @@ export interface JSHandle<T = any> {
58
72
59
73
export interface ElementHandle < T = Node > extends JSHandle < T > {
60
74
$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > | null > ;
61
- $ ( selector : string ) : Promise < ElementHandle < Element > | null > ;
75
+ $ ( selector : string ) : Promise < HTMLOrSVGElementHandle | null > ;
76
+
77
+ $$ < K extends keyof HTMLElementTagNameMap > ( selector : K ) : Promise < ElementHandleForTag < K > [ ] > ;
78
+ $$ ( selector : string ) : Promise < HTMLOrSVGElementHandle [ ] > ;
62
79
63
80
$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
64
- $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
81
+ $eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
65
82
66
83
$$eval < K extends keyof HTMLElementTagNameMap , Args extends any [ ] , R > ( selector : K , pageFunction : PageFunctionOn < HTMLElementTagNameMap [ K ] [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
67
- $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < Element [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
68
- }
69
-
70
- export interface ChromiumBrowser extends Browser {
71
- newPage ( options ?: BrowserNewPageOptions ) : Promise < Page < ChromiumBrowserContext > > ;
84
+ $$eval < Args extends any [ ] , R > ( selector : string , pageFunction : PageFunctionOn < HTMLOrSVGElement [ ] , Args , R > , ...args : Boxed < Args > ) : Promise < R > ;
72
85
}
73
86
74
87
export interface BrowserType < Browser > {
0 commit comments