Skip to content

Commit 00e9a6e

Browse files
feat: Added typing for AppiumBy (#1071)
* feat: Added typing for AppiumBy types * fix: using single quotes * fix: adding selenium typing * fix: pipeline
1 parent ea61c2e commit 00e9a6e

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

appium/webdriver/common/appiumby.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from typing import Literal
16+
1517
from selenium.webdriver.common.by import By
1618

1719

@@ -32,3 +34,20 @@ class AppiumBy(By):
3234
FLUTTER_INTEGRATION_KEY = '-flutter key'
3335
FLUTTER_INTEGRATION_TEXT = '-flutter text'
3436
FLUTTER_INTEGRATION_TEXT_CONTAINING = '-flutter text containing'
37+
38+
39+
ByType = Literal[
40+
'-ios predicate string',
41+
'-ios class chain',
42+
'-android uiautomator',
43+
'-android viewtag',
44+
'-android datamatcher',
45+
'-android viewmatcher',
46+
'accessibility id',
47+
'-image',
48+
'-custom',
49+
'-flutter semantics label',
50+
'-flutter type',
51+
'-flutter key',
52+
'-flutter text containing',
53+
]

appium/webdriver/extensions/flutter_integration/flutter_finder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from typing import Tuple
18+
from typing import Tuple, Union
19+
20+
from selenium.webdriver.common.by import ByType as SeleniumByType
1921

2022
from appium.webdriver.common.appiumby import AppiumBy
23+
from appium.webdriver.common.appiumby import ByType as AppiumByType
2124

2225

2326
class FlutterFinder:
24-
def __init__(self, using: str, value: str) -> None:
27+
def __init__(self, using: Union[SeleniumByType, AppiumByType], value: str) -> None:
2528
self.using = using
2629
self.value = value
2730

0 commit comments

Comments
 (0)