Skip to content

Commit 131776b

Browse files
committed
apply add_command
1 parent ac1871a commit 131776b

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

appium/webdriver/appium_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AppiumConnection(RemoteConnection):
3535
def __init__(
3636
self,
3737
remote_server_addr: str,
38-
keep_alive: Optional[bool] = True,
38+
keep_alive: Optional[bool] = False,
3939
ignore_proxy: Optional[bool] = False,
4040
init_args_for_pool_manager: Union[Dict[str, Any], None] = None,
4141
client_config: Optional[ClientConfig] = None,

appium/webdriver/extensions/android/activities.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ def wait_activity(self, activity: str, timeout: int, interval: int = 1) -> bool:
5656
return False
5757

5858
def _add_commands(self) -> None:
59-
# noinspection PyProtectedMember,PyUnresolvedReferences
60-
commands = self.command_executor._commands
61-
commands[Command.GET_CURRENT_ACTIVITY] = (
59+
self.command_executor.add_command(
60+
Command.GET_CURRENT_ACTIVITY,
6261
'GET',
6362
'/session/$sessionId/appium/device/current_activity',
6463
)

appium/webdriver/extensions/android/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ def current_package(self) -> str:
4747
return self.mark_extension_absence(ext_name).execute(Command.GET_CURRENT_PACKAGE)['value']
4848

4949
def _add_commands(self) -> None:
50-
# noinspection PyProtectedMember,PyUnresolvedReferences
51-
commands = self.command_executor._commands
52-
commands[Command.GET_CURRENT_PACKAGE] = (
50+
self.command_executor.add_command(
51+
Command.GET_CURRENT_PACKAGE,
5352
'GET',
5453
'/session/$sessionId/appium/device/current_package',
5554
)
56-
commands[Command.OPEN_NOTIFICATIONS] = (
55+
self.command_executor.add_command(
56+
Command.OPEN_NOTIFICATIONS,
5757
'POST',
5858
'/session/$sessionId/appium/device/open_notifications',
5959
)

appium/webdriver/extensions/android/display.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ def get_display_density(self) -> int:
4141
return self.mark_extension_absence(ext_name).execute(Command.GET_DISPLAY_DENSITY)['value']
4242

4343
def _add_commands(self) -> None:
44-
# noinspection PyProtectedMember,PyUnresolvedReferences
45-
commands = self.command_executor._commands
46-
commands[Command.GET_DISPLAY_DENSITY] = (
44+
self.command_executor.add_command(
45+
Command.GET_DISPLAY_DENSITY,
4746
'GET',
4847
'/session/$sessionId/appium/device/display_density',
4948
)

appium/webdriver/extensions/android/gsm.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ def set_gsm_voice(self, state: str) -> Self:
143143

144144
def _add_commands(self) -> None:
145145
# noinspection PyProtectedMember,PyUnresolvedReferences
146-
commands = self.command_executor._commands
147-
commands[Command.MAKE_GSM_CALL] = ('POST', '/session/$sessionId/appium/device/gsm_call')
148-
commands[Command.SET_GSM_SIGNAL] = (
149-
'POST',
150-
'/session/$sessionId/appium/device/gsm_signal',
151-
)
152-
commands[Command.SET_GSM_VOICE] = ('POST', '/session/$sessionId/appium/device/gsm_voice')
146+
self.command_executor.add_command(Command.MAKE_GSM_CALL, 'POST', '/session/$sessionId/appium/device/gsm_call')
147+
self.command_executor.add_command(Command.SET_GSM_SIGNAL, 'POST', '/session/$sessionId/appium/device/gsm_signal')
148+
self.command_executor.add_command(Command.SET_GSM_VOICE, 'POST', '/session/$sessionId/appium/device/gsm_voice')

0 commit comments

Comments
 (0)