1818from typing import TYPE_CHECKING , Any , List , Optional , TypeVar , Union
1919
2020from appium .common .logger import logger
21- from appium .webdriver .common .mobileby import MobileBy
21+ from appium .webdriver .common .appiumby import AppiumBy
2222
2323from .base_search_context import BaseSearchContext
2424
@@ -35,7 +35,8 @@ def find_element_by_android_view_matcher(
3535 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
3636 ) -> 'WebElement' :
3737 """
38- [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEW_MATCHER' instead.
38+ deprecated:: 2.1.0
39+ Please use 'find_element' with 'AppiumBy.ANDROID_VIEW_MATCHER' instead.
3940
4041 Finds element by [onView](https://developer.android.com/training/testing/espresso/basics) in Android
4142
@@ -61,17 +62,18 @@ def find_element_by_android_view_matcher(
6162 driver.find_element_by_android_view_matcher(name='withText', args=['Accessibility'], className='ViewMatchers')
6263 """
6364
64- logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy .ANDROID_VIEW_MATCHER' instead." )
65+ logger .warning ("[Deprecated] Please use 'find_element' with 'AppiumBy .ANDROID_VIEW_MATCHER' instead." )
6566
6667 return self .find_element (
67- by = MobileBy .ANDROID_VIEW_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
68+ by = AppiumBy .ANDROID_VIEW_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
6869 )
6970
7071 def find_element_by_android_data_matcher (
7172 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
7273 ) -> 'WebElement' :
7374 """
74- [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_DATA_MATCHER' instead.
75+ deprecated:: 2.1.0
76+ Please use 'find_element' with 'AppiumBy.ANDROID_DATA_MATCHER' instead.
7577
7678 Finds element by
7779 [onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android
@@ -98,17 +100,18 @@ def find_element_by_android_data_matcher(
98100 driver.find_element_by_android_data_matcher(name='hasEntry', args=['title', 'Animation'])
99101 """
100102
101- logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy .ANDROID_DATA_MATCHER' instead." )
103+ logger .warning ("[Deprecated] Please use 'find_element' with 'AppiumBy .ANDROID_DATA_MATCHER' instead." )
102104
103105 return self .find_element (
104- by = MobileBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
106+ by = AppiumBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
105107 )
106108
107109 def find_elements_by_android_data_matcher (
108110 self : T , name : Optional [str ] = None , args : Optional [Any ] = None , className : Optional [str ] = None
109111 ) -> List ['WebElement' ]:
110112 """
111- [Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_DATA_MATCHER' instead.
113+ deprecated:: 2.1.0
114+ Please use 'find_elements' with 'AppiumBy.ANDROID_DATA_MATCHER' instead.
112115
113116 Finds elements by
114117 [onData](https://medium.com/androiddevelopers/adapterviews-and-espresso-f4172aa853cf) in Android
@@ -131,10 +134,10 @@ def find_elements_by_android_data_matcher(
131134 driver.find_elements_by_android_data_matcher(name='hasEntry', args=['title', 'Animation'])
132135 """
133136
134- logger .warning ("[Deprecated] Please use 'find_elements' with 'MobileBy .ANDROID_DATA_MATCHER' instead." )
137+ logger .warning ("[Deprecated] Please use 'find_elements' with 'AppiumBy .ANDROID_DATA_MATCHER' instead." )
135138
136139 return self .find_elements (
137- by = MobileBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
140+ by = AppiumBy .ANDROID_DATA_MATCHER , value = self ._build_data_matcher (name = name , args = args , className = className )
138141 )
139142
140143 def _build_data_matcher (
@@ -150,7 +153,8 @@ def _build_data_matcher(
150153
151154 def find_element_by_android_uiautomator (self : T , uia_string : str ) -> 'WebElement' :
152155 """
153- [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_UIAUTOMATOR' instead.
156+ deprecated:: 2.1.0
157+ Please use 'find_element' with 'AppiumBy.ANDROID_UIAUTOMATOR' instead.
154158
155159 Finds element by uiautomator in Android.
156160
@@ -164,13 +168,13 @@ def find_element_by_android_uiautomator(self: T, uia_string: str) -> 'WebElement
164168 `appium.webdriver.webelement.WebElement`: The found element
165169 """
166170
167- logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy .ANDROID_UIAUTOMATOR' instead." )
171+ logger .warning ("[Deprecated] Please use 'find_element' with 'AppiumBy .ANDROID_UIAUTOMATOR' instead." )
168172
169- return self .find_element (by = MobileBy .ANDROID_UIAUTOMATOR , value = uia_string )
173+ return self .find_element (by = AppiumBy .ANDROID_UIAUTOMATOR , value = uia_string )
170174
171175 def find_elements_by_android_uiautomator (self : T , uia_string : str ) -> List ['WebElement' ]:
172176 """
173- [Deprecated] Please use 'find_elements' with 'MobileBy .ANDROID_UIAUTOMATOR' instead.
177+ [Deprecated] Please use 'find_elements' with 'AppiumBy .ANDROID_UIAUTOMATOR' instead.
174178
175179 Finds elements by uiautomator in Android.
176180
@@ -184,13 +188,14 @@ def find_elements_by_android_uiautomator(self: T, uia_string: str) -> List['WebE
184188 :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements
185189 """
186190
187- logger .warning ("[Deprecated] Please use 'find_elements' with 'MobileBy .ANDROID_UIAUTOMATOR' instead." )
191+ logger .warning ("[Deprecated] Please use 'find_elements' with 'AppiumBy .ANDROID_UIAUTOMATOR' instead." )
188192
189- return self .find_elements (by = MobileBy .ANDROID_UIAUTOMATOR , value = uia_string )
193+ return self .find_elements (by = AppiumBy .ANDROID_UIAUTOMATOR , value = uia_string )
190194
191195 def find_element_by_android_viewtag (self : T , tag : str ) -> 'WebElement' :
192196 """
193- [Deprecated] Please use 'find_element' with 'MobileBy.ANDROID_VIEWTAG' instead.
197+ deprecated:: 2.1.0
198+ Please use 'find_element' with 'AppiumBy.ANDROID_VIEWTAG' instead.
194199
195200 Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
196201
@@ -206,13 +211,14 @@ def find_element_by_android_viewtag(self: T, tag: str) -> 'WebElement':
206211 `appium.webdriver.webelement.WebElement`: The found element
207212 """
208213
209- logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy .ANDROID_VIEWTAG' instead." )
214+ logger .warning ("[Deprecated] Please use 'find_element' with 'AppiumBy .ANDROID_VIEWTAG' instead." )
210215
211- return self .find_element (by = MobileBy .ANDROID_VIEWTAG , value = tag )
216+ return self .find_element (by = AppiumBy .ANDROID_VIEWTAG , value = tag )
212217
213218 def find_elements_by_android_viewtag (self : T , tag : str ) -> List ['WebElement' ]:
214219 """
215- [Deprecated] Please use 'find_elements' with 'MobileBy.ANDROID_VIEWTAG' instead.
220+ deprecated:: 2.1.0
221+ Please use 'find_elements' with 'AppiumBy.ANDROID_VIEWTAG' instead.
216222
217223 Finds element by [View#tags](https://developer.android.com/reference/android/view/View#tags) in Android.
218224
@@ -228,6 +234,6 @@ def find_elements_by_android_viewtag(self: T, tag: str) -> List['WebElement']:
228234 :obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements
229235 """
230236
231- logger .warning ("[Deprecated] Please use 'find_element' with 'MobileBy .ANDROID_VIEWTAG' instead." )
237+ logger .warning ("[Deprecated] Please use 'find_element' with 'AppiumBy .ANDROID_VIEWTAG' instead." )
232238
233- return self .find_elements (by = MobileBy .ANDROID_VIEWTAG , value = tag )
239+ return self .find_elements (by = AppiumBy .ANDROID_VIEWTAG , value = tag )
0 commit comments