@@ -49,13 +49,63 @@ 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, unless the method has overloads. for example:
64
+ ``` py
65
+ def wait_for_selector (self , selector : str , timeout : float = None , state : str = None ): ...
66
+ ```
67
+ becomes
68
+ ``` py
69
+ def wait_for_selector (self , selector : str , * , timeout : float = None , state : str = 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
+ from playwright._impl._overload import api_overload
75
+
76
+ @api_overload
77
+ async def wait_for_selector (
78
+ self ,
79
+ selector : str ,
80
+ * ,
81
+ timeout : float = None ,
82
+ state : Literal[" attached" , " visible" ] = None ,
83
+ strict : bool = None ,
84
+ ) -> ElementHandle:
85
+ pass
86
+
87
+ @api_overload # type: ignore [ no -redef ]
88
+ async def wait_for_selector (
89
+ self ,
90
+ selector : str ,
91
+ * ,
92
+ timeout : float = None ,
93
+ state : Literal[" detached" , " hidden" ],
94
+ strict : bool = None ,
95
+ ) -> None :
96
+ pass
97
+
98
+ async def wait_for_selector ( # type: ignore [ no -redef ]
99
+ self ,
100
+ selector : str ,
101
+ * ,
102
+ timeout : float = None ,
103
+ state : Literal[" attached" , " detached" , " hidden" , " visible" ] = None ,
104
+ strict : bool = None ,
105
+ ) -> Optional[ElementHandle]:
106
+ ...
107
+ ```
108
+
59
109
## Contributor License Agreement
60
110
61
111
This project welcomes contributions and suggestions. Most contributions require you to agree to a
0 commit comments