Skip to content

Commit 264f202

Browse files
refactor!: remove several previously deprecated APIs (#909)
BREAKING CHANGE: Removed obsolete all_sessions and session properties BREAKING CHANGE: Removed the obsolete start_activity method BREAKING CHANGE: Removed the obsolete end_test_coverage method BREAKING CHANGE: Removed the following obsolete arguments from the driver constructor: desired_capabilities, browser_profile, proxy BREAKING CHANGE: Removed obsolete set_value and set_text methods BREAKING CHANGE: Removed the obsolete MobileBy class BREAKING CHANGE: Removed obsolete application management methods: launch_app, close_app, reset BREAKING CHANGE: Removed obsolete IME methods: available_ime_engines, is_ime_active, activate_ime_engine, deactivate_ime_engine, active_ime_engine
1 parent 2e49569 commit 264f202

File tree

19 files changed

+36
-714
lines changed

19 files changed

+36
-714
lines changed

appium/webdriver/common/mobileby.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

appium/webdriver/extensions/android/activities.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import warnings
16-
from typing import TYPE_CHECKING, cast
17-
1815
from selenium.common.exceptions import TimeoutException, UnknownMethodException
1916
from selenium.webdriver.support.ui import WebDriverWait
2017

@@ -23,52 +20,8 @@
2320
from appium.protocols.webdriver.can_remember_extension_presence import CanRememberExtensionPresence
2421
from appium.webdriver.mobilecommand import MobileCommand as Command
2522

26-
if TYPE_CHECKING:
27-
from appium.webdriver.webdriver import WebDriver
28-
2923

3024
class Activities(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
31-
def start_activity(self, app_package: str, app_activity: str, **opts: str) -> 'WebDriver':
32-
"""Opens an arbitrary activity during a test. If the activity belongs to
33-
another application, that application is started and the activity is opened.
34-
deprecated:: 2.9.0
35-
36-
This is an Android-only method.
37-
38-
Args:
39-
app_package: The package containing the activity to start.
40-
app_activity: The activity to start.
41-
42-
Keyword Args:
43-
app_wait_package (str): Begin automation after this package starts.
44-
app_wait_activity (str): Begin automation after this activity starts.
45-
intent_action (str): Intent to start.
46-
intent_category (str): Intent category to start.
47-
intent_flags (str): Flags to send to the intent.
48-
optional_intent_arguments (str): Optional arguments to the intent.
49-
dont_stop_app_on_reset (str): Should the app be stopped on reset?
50-
"""
51-
warnings.warn(
52-
'The "session" API is deprecated. Use "mobile: startActivity" extension instead.',
53-
DeprecationWarning,
54-
)
55-
56-
data = {'appPackage': app_package, 'appActivity': app_activity}
57-
arguments = {
58-
'app_wait_package': 'appWaitPackage',
59-
'app_wait_activity': 'appWaitActivity',
60-
'intent_action': 'intentAction',
61-
'intent_category': 'intentCategory',
62-
'intent_flags': 'intentFlags',
63-
'optional_intent_arguments': 'optionalIntentArguments',
64-
'dont_stop_app_on_reset': 'dontStopAppOnReset',
65-
}
66-
for key, value in arguments.items():
67-
if key in opts:
68-
data[value] = opts[key]
69-
self.execute(Command.START_ACTIVITY, data)
70-
return cast('WebDriver', self)
71-
7225
@property
7326
def current_activity(self) -> str:
7427
"""Retrieves the current activity running on the device.
@@ -109,7 +62,3 @@ def _add_commands(self) -> None:
10962
'GET',
11063
'/session/$sessionId/appium/device/current_activity',
11164
)
112-
commands[Command.START_ACTIVITY] = (
113-
'POST',
114-
'/session/$sessionId/appium/device/start_activity',
115-
)

appium/webdriver/extensions/android/common.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,6 @@
2626

2727

2828
class Common(CanExecuteCommands, CanExecuteScripts, CanRememberExtensionPresence):
29-
def end_test_coverage(self, intent: str, path: str) -> Any:
30-
"""Ends the coverage collection and pull the coverage.ec file from the device.
31-
deprecated:: 2.9.0
32-
33-
Android only.
34-
See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/android-coverage.md
35-
36-
Args:
37-
intent: description of operation to be performed
38-
path: path to coverage.ec file to be pulled from the device
39-
40-
Returns:
41-
TODO
42-
"""
43-
warnings.warn(
44-
'This API is deprecated and will be removed in future versions',
45-
DeprecationWarning,
46-
)
47-
return self.execute(
48-
Command.END_TEST_COVERAGE,
49-
{
50-
'intent': intent,
51-
'path': path,
52-
},
53-
)['value']
54-
5529
def open_notifications(self) -> 'WebDriver':
5630
"""Open notification shade in Android (API Level 18 and above)
5731
@@ -83,10 +57,6 @@ def _add_commands(self) -> None:
8357
'GET',
8458
'/session/$sessionId/appium/device/current_package',
8559
)
86-
commands[Command.END_TEST_COVERAGE] = (
87-
'POST',
88-
'/session/$sessionId/appium/app/end_test_coverage',
89-
)
9060
commands[Command.OPEN_NOTIFICATIONS] = (
9161
'POST',
9262
'/session/$sessionId/appium/device/open_notifications',

appium/webdriver/extensions/applications.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import warnings
1514
from typing import TYPE_CHECKING, Any, Dict, Union, cast
1615

1716
from selenium.common.exceptions import InvalidArgumentException, UnknownMethodException
@@ -145,39 +144,6 @@ def remove_app(self, app_id: str, **options: Any) -> 'WebDriver':
145144
self.mark_extension_absence(ext_name).execute(Command.REMOVE_APP, data)
146145
return cast('WebDriver', self)
147146

148-
def launch_app(self) -> 'WebDriver':
149-
"""Start on the device the application specified in the desired capabilities.
150-
deprecated:: 2.0.0
151-
152-
Returns:
153-
Union['WebDriver', 'Applications']: Self instance
154-
"""
155-
warnings.warn(
156-
'The "launchApp" API is deprecated and will be removed in future versions. '
157-
'See https://github.com/appium/appium/issues/15807',
158-
DeprecationWarning,
159-
)
160-
161-
self.execute(Command.LAUNCH_APP)
162-
return cast('WebDriver', self)
163-
164-
def close_app(self) -> 'WebDriver':
165-
"""Stop the running application, specified in the desired capabilities, on
166-
the device.
167-
deprecated:: 2.0.0
168-
169-
Returns:
170-
Union['WebDriver', 'Applications']: Self instance
171-
"""
172-
warnings.warn(
173-
'The "closeApp" API is deprecated and will be removed in future versions. '
174-
'See https://github.com/appium/appium/issues/15807',
175-
DeprecationWarning,
176-
)
177-
178-
self.execute(Command.CLOSE_APP)
179-
return cast('WebDriver', self)
180-
181147
def terminate_app(self, app_id: str, **options: Any) -> bool:
182148
"""Terminates the application if it is running.
183149
@@ -283,22 +249,6 @@ def app_strings(self, language: Union[str, None] = None, string_file: Union[str,
283249
# TODO: Remove the fallback
284250
return self.mark_extension_absence(ext_name).execute(Command.GET_APP_STRINGS, data)['value']
285251

286-
def reset(self) -> 'WebDriver':
287-
"""Resets the current application on the device.
288-
deprecated:: 2.0.0
289-
290-
Returns:
291-
Union['WebDriver', 'Applications']: Self instance
292-
"""
293-
warnings.warn(
294-
'The "reset" API is deprecated and will be removed in future versions. '
295-
'See https://github.com/appium/appium/issues/15807',
296-
DeprecationWarning,
297-
)
298-
299-
self.execute(Command.RESET)
300-
return cast('WebDriver', self)
301-
302252
def _add_commands(self) -> None:
303253
# noinspection PyProtectedMember,PyUnresolvedReferences
304254
commands = self.command_executor._commands
@@ -322,6 +272,3 @@ def _add_commands(self) -> None:
322272
'/session/$sessionId/appium/device/app_state',
323273
)
324274
commands[Command.GET_APP_STRINGS] = ('POST', '/session/$sessionId/appium/app/strings')
325-
commands[Command.RESET] = ('POST', '/session/$sessionId/appium/app/reset')
326-
commands[Command.LAUNCH_APP] = ('POST', '/session/$sessionId/appium/app/launch')
327-
commands[Command.CLOSE_APP] = ('POST', '/session/$sessionId/appium/app/close')

appium/webdriver/extensions/ime.py

Lines changed: 0 additions & 141 deletions
This file was deleted.

0 commit comments

Comments
 (0)