55
66
77Locator = Tuple [str , str ]
8+ type Condition = Literal ["clickable" , "visible" , "present" ]
9+ type Direction = Literal ["down" , "up" ]
810
911
1012class Screen (ElementInteractor ):
1113 def __init__ (self , driver ):
1214 super ().__init__ (driver )
1315
14- def click (
15- self ,
16- locator : Locator ,
17- condition : Literal ["clickable" , "visible" , "present" ] = "clickable" ,
18- ):
16+ def click (self , locator : Locator , condition : Condition = "clickable" ):
1917 element = self .element (locator , condition = condition )
2018 element .click ()
2119
@@ -61,7 +59,7 @@ def swipe(
6159
6260 def scroll (
6361 self ,
64- directions : Literal [ "down" , "up" ] = "down" ,
62+ directions : Direction = "down" ,
6563 start_ratio : float = 0.7 ,
6664 end_ratio : float = 0.3 ,
6765 ):
@@ -111,7 +109,7 @@ def scroll_to_element(
111109 def scroll_until_element_visible (
112110 self ,
113111 destination_el : Locator ,
114- directions : Literal [ "down" , "up" ] = "down" ,
112+ directions : Direction = "down" ,
115113 start_ratio : float = 0.6 ,
116114 end_ratio : float = 0.3 ,
117115 retries : int = 1 ,
@@ -126,10 +124,7 @@ def type(self, locator: Locator, text: str):
126124 element .send_keys (text )
127125
128126 def double_tap (
129- self ,
130- locator : Locator ,
131- condition : Literal ["clickable" , "visible" , "present" ] = "clickable" ,
132- ** kwargs ,
127+ self , locator : Locator , condition : Condition = "clickable" , ** kwargs
133128 ):
134129 """Double taps on an element."""
135130 try :
0 commit comments