1717import json
1818from typing import TYPE_CHECKING , Any , List , Optional , TypeVar , Union
1919
20+ from appium .common .logger import logger
2021from appium .webdriver .common .mobileby import MobileBy
2122
2223from .base_search_context import BaseSearchContext
@@ -33,7 +34,10 @@ class AndroidSearchContext(BaseSearchContext):
3334 def find_element_by_android_view_matcher (
3435 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
3536 ) -> 'WebElement' :
36- """Finds element by [onView](https://developer.android.com/training/testing/espresso/basics) in Android
37+ """
38+ [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEW_MATCHER' instead.
39+
40+ Finds element by [onView](https://developer.android.com/training/testing/espresso/basics) in Android
3741
3842 It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
3943
@@ -57,14 +61,19 @@ def find_element_by_android_view_matcher(
5761 driver.find_element_by_android_view_matcher(name='withText', args=['Accessibility'], className='ViewMatchers')
5862 """
5963
64+ logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEW_MATCHER' instead." )
65+
6066 return self .find_element (
6167 by = MobileBy .ANDROID_VIEW_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
6268 )
6369
6470 def find_element_by_android_data_matcher (
6571 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
6672 ) -> 'WebElement' :
67- """Finds element by
73+ """
74+ [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_DATA_MATCHER' instead.
75+
76+ Finds element by
6877 [onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android
6978
7079 It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
@@ -89,14 +98,19 @@ def find_element_by_android_data_matcher(
8998 driver.find_element_by_android_data_matcher(name='hasEntry', args=['title', 'Animation'])
9099 """
91100
101+ logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_DATA_MATCHER' instead." )
102+
92103 return self .find_element (
93104 by = MobileBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
94105 )
95106
96107 def find_elements_by_android_data_matcher (
97108 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
98109 ) -> List ['WebElement' ]:
99- """Finds elements by
110+ """
111+ [Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_DATA_MATCHER' instead.
112+
113+ Finds elements by
100114 [onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android
101115 It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
102116
@@ -117,6 +131,8 @@ def find_elements_by_android_data_matcher(
117131 driver.find_elements_by_android_data_matcher(name='hasEntry', args=['title', 'Animation'])
118132 """
119133
134+ logger .warning ("[Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_DATA_MATCHER' instead." )
135+
120136 return self .find_elements (
121137 by = MobileBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
122138 )
@@ -133,7 +149,10 @@ def _build_data_matcher(
133149 return json .dumps (result )
134150
135151 def find_element_by_android_uiautomator (self : T , uia_string : str ) -> 'WebElement' :
136- """Finds element by uiautomator in Android.
152+ """
153+ [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_UIAUTOMATOR' instead.
154+
155+ Finds element by uiautomator in Android.
137156
138157 Args:
139158 uia_string: The element name in the Android UIAutomator library
@@ -144,10 +163,16 @@ def find_element_by_android_uiautomator(self: T, uia_string: str) -> 'WebElement
144163 Returns:
145164 `appium.webdriver.webelement.WebElement`: The found element
146165 """
166+
167+ logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_UIAUTOMATOR' instead." )
168+
147169 return self .find_element (by = MobileBy .ANDROID_UIAUTOMATOR , value = uia_string )
148170
149171 def find_elements_by_android_uiautomator (self : T , uia_string : str ) -> List ['WebElement' ]:
150- """Finds elements by uiautomator in Android.
172+ """
173+ [Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_UIAUTOMATOR' instead.
174+
175+ Finds elements by uiautomator in Android.
151176
152177 Args:
153178 uia_string: The element name in the Android UIAutomator library
@@ -158,10 +183,16 @@ def find_elements_by_android_uiautomator(self: T, uia_string: str) -> List['WebE
158183 Returns:
159184 :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements
160185 """
186+
187+ logger .warning ("[Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_UIAUTOMATOR' instead." )
188+
161189 return self .find_elements (by = MobileBy .ANDROID_UIAUTOMATOR , value = uia_string )
162190
163191 def find_element_by_android_viewtag (self : T , tag : str ) -> 'WebElement' :
164- """Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
192+ """
193+ [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEWTAG' instead.
194+
195+ Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
165196
166197 It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
167198
@@ -174,10 +205,16 @@ def find_element_by_android_viewtag(self: T, tag: str) -> 'WebElement':
174205 Returns:
175206 `appium.webdriver.webelement.WebElement`: The found element
176207 """
208+
209+ logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEWTAG' instead." )
210+
177211 return self .find_element (by = MobileBy .ANDROID_VIEWTAG , value = tag )
178212
179213 def find_elements_by_android_viewtag (self : T , tag : str ) -> List ['WebElement' ]:
180- """Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
214+ """
215+ [Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_VIEWTAG' instead.
216+
217+ Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
181218
182219 It works with [Espresso Driver](https://github.com/appium/appium-espresso-driver).
183220
@@ -190,4 +227,7 @@ def find_elements_by_android_viewtag(self: T, tag: str) -> List['WebElement']:
190227 Returns:
191228 :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements
192229 """
230+
231+ logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEWTAG' instead." )
232+
193233 return self .find_elements (by = MobileBy .ANDROID_VIEWTAG , value = tag )
0 commit comments