(
self,
command_executor: Union[str, AppiumConnection] = 'http://127.0.0.1:4723',
extensions: Optional[List[Type['ExtensionBase']]] = None,
options: Union[AppiumOptions, List[AppiumOptions], None] = None,
client_config: Optional[AppiumClientConfig] = None,
)
| 239 | SystemBars, |
| 240 | ): |
| 241 | def __init__( |
| 242 | self, |
| 243 | command_executor: Union[str, AppiumConnection] = 'http://127.0.0.1:4723', |
| 244 | extensions: Optional[List[Type['ExtensionBase']]] = None, |
| 245 | options: Union[AppiumOptions, List[AppiumOptions], None] = None, |
| 246 | client_config: Optional[AppiumClientConfig] = None, |
| 247 | ): |
| 248 | command_executor, client_config = _get_remote_connection_and_client_config( |
| 249 | command_executor=command_executor, client_config=client_config |
| 250 | ) |
| 251 | super().__init__( |
| 252 | command_executor=command_executor, |
| 253 | options=options, # type: ignore[arg-type] |
| 254 | locator_converter=AppiumLocatorConverter(), |
| 255 | web_element_cls=MobileWebElement, |
| 256 | client_config=client_config, |
| 257 | ) |
| 258 | |
| 259 | # to explicitly set type after the initialization |
| 260 | self.command_executor: RemoteConnection |
| 261 | |
| 262 | self._add_commands() |
| 263 | |
| 264 | self.error_handler = MobileErrorHandler() |
| 265 | |
| 266 | if client_config and client_config.direct_connection: |
| 267 | self._update_command_executor(keep_alive=client_config.keep_alive) |
| 268 | |
| 269 | self._absent_extensions: Set[str] = set() |
| 270 | |
| 271 | self._extensions = extensions or [] |
| 272 | for extension in self._extensions: |
| 273 | instance = extension(self.execute) |
| 274 | method_name = instance.method_name() |
| 275 | if hasattr(WebDriver, method_name): |
| 276 | logger.debug(f"Overriding the method '{method_name}'") |
| 277 | |
| 278 | # add a new method named 'instance.method_name()' and call it |
| 279 | setattr(WebDriver, method_name, getattr(instance, method_name)) |
| 280 | method, url_cmd = instance.add_command() |
| 281 | self.command_executor.add_command(method_name, method.upper(), url_cmd) |
| 282 | |
| 283 | if TYPE_CHECKING: |
| 284 |
nothing calls this directly
no test coverage detected