|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union |
| 15 | +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Union |
16 | 16 |
|
17 | 17 | from selenium import webdriver |
18 | 18 | from selenium.common.exceptions import ( |
@@ -250,12 +250,15 @@ def __init__( |
250 | 250 | ) |
251 | 251 | super().__init__( |
252 | 252 | command_executor=command_executor, |
253 | | - options=options, |
| 253 | + options=options, # type: ignore[arg-type] |
254 | 254 | locator_converter=AppiumLocatorConverter(), |
255 | 255 | web_element_cls=MobileWebElement, |
256 | 256 | client_config=client_config, |
257 | 257 | ) |
258 | 258 |
|
| 259 | + # to explicitly set type after the initialization |
| 260 | + self.command_executor: RemoteConnection |
| 261 | + |
259 | 262 | self._add_commands() |
260 | 263 |
|
261 | 264 | self.error_handler = MobileErrorHandler() |
@@ -286,6 +289,14 @@ def __init__( |
286 | 289 | method, url_cmd = instance.add_command() |
287 | 290 | self.command_executor.add_command(method_name, method.upper(), url_cmd) |
288 | 291 |
|
| 292 | + if TYPE_CHECKING: |
| 293 | + |
| 294 | + def find_element(self, by: str, value: Union[str, Dict, None] = None) -> 'MobileWebElement': # type: ignore[override] |
| 295 | + ... |
| 296 | + |
| 297 | + def find_elements(self, by: str, value: Union[str, Dict, None] = None) -> List['MobileWebElement']: # type: ignore[override] |
| 298 | + ... |
| 299 | + |
289 | 300 | def delete_extensions(self) -> None: |
290 | 301 | """Delete extensions added in the class with 'setattr'""" |
291 | 302 | for extension in self._extensions: |
|
0 commit comments