@@ -49,13 +49,61 @@ pre-commit run --all-files
49
49
50
50
For more details look at the [ CI configuration] ( ./blob/master/.github/workflows/ci.yml ) .
51
51
52
- ### Regenerating APIs
52
+ ### APIs
53
+
54
+ #### Regenerating
53
55
54
56
``` bash
55
57
./scripts/update_api.sh
56
58
pre-commit run --all-files
57
59
```
58
60
61
+ #### Differences between ` _impl ` and exposed API method signatures
62
+
63
+ - optional arguments are automatically converted to keyword arguments. for example:
64
+ ``` py
65
+ def wait_for_selector (self , selector : str , timeout : float = None , state : Literal[" attached" , " visible" ] = None )
66
+ ```
67
+ becomes
68
+ ``` py
69
+ def wait_for_selector (self , selector : str , * , timeout : float = None , state : Literal[" attached" , " visible" ] = None )
70
+ ```
71
+
72
+ - overloads must be defined using ` @api_overload ` in order for the generate scripts to be able to see them at runtime.
73
+ ``` py
74
+ @api_overload
75
+ async def wait_for_selector (
76
+ self ,
77
+ selector : str ,
78
+ * ,
79
+ timeout : float = None ,
80
+ state : Literal[" attached" , " visible" ] = None ,
81
+ strict : bool = None ,
82
+ ) -> ElementHandle:
83
+ pass
84
+
85
+ @api_overload # type: ignore [ no -redef ]
86
+ async def wait_for_selector (
87
+ self ,
88
+ selector : str ,
89
+ * ,
90
+ timeout : float = None ,
91
+ state : Literal[" detached" , " hidden" ],
92
+ strict : bool = None ,
93
+ ) -> None :
94
+ pass
95
+
96
+ async def wait_for_selector ( # type: ignore [ no -redef ]
97
+ self ,
98
+ selector : str ,
99
+ * ,
100
+ timeout : float = None ,
101
+ state : Literal[" attached" , " detached" , " hidden" , " visible" ] = None ,
102
+ strict : bool = None ,
103
+ ) -> Optional[ElementHandle]:
104
+ ...
105
+ ```
106
+
59
107
## Contributor License Agreement
60
108
61
109
This project welcomes contributions and suggestions. Most contributions require you to agree to a
0 commit comments