diff --git a/appium/webdriver/common/appiumby.py b/appium/webdriver/common/appiumby.py index b269bb0f..14526899 100644 --- a/appium/webdriver/common/appiumby.py +++ b/appium/webdriver/common/appiumby.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Literal + from selenium.webdriver.common.by import By @@ -32,3 +34,20 @@ class AppiumBy(By): FLUTTER_INTEGRATION_KEY = '-flutter key' FLUTTER_INTEGRATION_TEXT = '-flutter text' FLUTTER_INTEGRATION_TEXT_CONTAINING = '-flutter text containing' + + +ByType = Literal[ + '-ios predicate string', + '-ios class chain', + '-android uiautomator', + '-android viewtag', + '-android datamatcher', + '-android viewmatcher', + 'accessibility id', + '-image', + '-custom', + '-flutter semantics label', + '-flutter type', + '-flutter key', + '-flutter text containing', +] diff --git a/appium/webdriver/extensions/flutter_integration/flutter_finder.py b/appium/webdriver/extensions/flutter_integration/flutter_finder.py index 473976ba..2e5db4ec 100644 --- a/appium/webdriver/extensions/flutter_integration/flutter_finder.py +++ b/appium/webdriver/extensions/flutter_integration/flutter_finder.py @@ -15,13 +15,16 @@ # specific language governing permissions and limitations # under the License. -from typing import Tuple +from typing import Tuple, Union + +from selenium.webdriver.common.by import ByType as SeleniumByType from appium.webdriver.common.appiumby import AppiumBy +from appium.webdriver.common.appiumby import ByType as AppiumByType class FlutterFinder: - def __init__(self, using: str, value: str) -> None: + def __init__(self, using: Union[SeleniumByType, AppiumByType], value: str) -> None: self.using = using self.value = value