Skip to content

Commit 8ec5441

Browse files
authored
chore: deprecate -windows uiautomation (#649)
* chore: add Deprecated for -windows uiautomation * chore: add logger
1 parent 268a7dd commit 8ec5441

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

appium/webdriver/common/mobileby.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class MobileBy(By):
2323
ANDROID_VIEWTAG = '-android viewtag'
2424
ANDROID_DATA_MATCHER = '-android datamatcher'
2525
ANDROID_VIEW_MATCHER = '-android viewmatcher'
26+
# Deprecated
2627
WINDOWS_UI_AUTOMATION = '-windows uiautomation'
2728
ACCESSIBILITY_ID = 'accessibility id'
2829
IMAGE = '-image'

appium/webdriver/extensions/search_context/windows.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from typing import TYPE_CHECKING, List, TypeVar, Union
1818

19+
from appium.common.logger import logger
1920
from appium.webdriver.common.mobileby import MobileBy
2021

2122
from .base_search_context import BaseSearchContext
@@ -30,7 +31,7 @@ class WindowsSearchContext(BaseSearchContext):
3031
"""Define search context for Windows"""
3132

3233
def find_element_by_windows_uiautomation(self: T, win_uiautomation: str) -> 'WebElement':
33-
"""Finds an element by windows uiautomation
34+
"""[Deprecated] Finds an element by windows uiautomation
3435
3536
Args:
3637
win_uiautomation: The element name in the windows UIAutomation selector
@@ -42,10 +43,13 @@ def find_element_by_windows_uiautomation(self: T, win_uiautomation: str) -> 'Web
4243
`appium.webdriver.webelement.WebElement`: The found element
4344
4445
"""
46+
logger.warning(
47+
"[Deprecated] '-windows uiautomation' selector is deprecated. Please use other locators like id."
48+
)
4549
return self.find_element(by=MobileBy.WINDOWS_UI_AUTOMATION, value=win_uiautomation)
4650

4751
def find_elements_by_windows_uiautomation(self: T, win_uiautomation: str) -> List['WebElement']:
48-
"""Finds elements by windows uiautomation
52+
"""[Deprecated] Finds elements by windows uiautomation
4953
5054
Args:
5155
win_uiautomation: The element name in the windows UIAutomation selector
@@ -56,4 +60,7 @@ def find_elements_by_windows_uiautomation(self: T, win_uiautomation: str) -> Lis
5660
Returns:
5761
:obj:`list` of :obj:`appium.webdriver.webelement.WebElement`: The found elements
5862
"""
63+
logger.warning(
64+
"[Deprecated] '-windows uiautomation' selector is deprecated. Please use other locators like id."
65+
)
5966
return self.find_elements(by=MobileBy.WINDOWS_UI_AUTOMATION, value=win_uiautomation)

0 commit comments

Comments
 (0)