Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added typing for AppiumBy #1071

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions appium/webdriver/common/appiumby.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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[
Brijeshkrishna marked this conversation as resolved.
Show resolved Hide resolved
'-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',
]
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down