robotframework-appiumwindows 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -510,9 +510,46 @@ class _ElementKeywords(KeywordGroup):
510
510
 
511
511
  # TODO temporary add, will remove in the future
512
512
  def appium_click_until(self, locators: list, timeout=None, handle_error=True):
513
- return self.appium_click_first_match(locators=locators, timeout=timeout, handle_error=handle_error)
513
+ """
514
+ Click any element in the list of locators until all elements are not found.
515
+
516
+ Args:
517
+ locators: List of locators to try in order.
518
+ timeout: Maximum time to wait for an element to appear (default: None).
519
+ handle_error: Whether to handle errors (default: True).
520
+ """
521
+ self._info(f"Appium Click Until: locators='{locators}', timeout='{timeout}', handle_error='{handle_error}'")
522
+
523
+ def func():
524
+ found = False
525
+ for locator in locators:
526
+ element = self._element_find(locator, True, False)
527
+ if element:
528
+ element.click()
529
+ found = True
530
+
531
+ if not found:
532
+ return False
533
+ raise Exception(f"Still found element in {locators}, retrying...")
534
+
535
+ return self._retry(
536
+ timeout,
537
+ func,
538
+ action=f"Click until '{locators}'",
539
+ required=not handle_error,
540
+ return_value=False,
541
+ poll_interval=None
542
+ )
514
543
 
515
544
  def appium_click_first_match(self, locators: list, timeout=None, handle_error=True):
545
+ """
546
+ Click the first element in the list of locators that appears.
547
+
548
+ Args:
549
+ locators: List of locators to try in order.
550
+ timeout: Maximum time to wait for an element to appear (default: None).
551
+ handle_error: Whether to handle errors (default: True).
552
+ """
516
553
  self._info(f"Appium Click First Match: locators='{locators}', timeout='{timeout}', handle_error='{handle_error}'")
517
554
 
518
555
  def func():
@@ -533,6 +570,7 @@ class _ElementKeywords(KeywordGroup):
533
570
  func,
534
571
  action=f"Click until '{locators}'",
535
572
  required=not handle_error,
573
+ return_value=False,
536
574
  poll_interval=None
537
575
  )
538
576
 
@@ -1183,7 +1221,7 @@ class _ElementKeywords(KeywordGroup):
1183
1221
 
1184
1222
  time.sleep(poll)
1185
1223
 
1186
- if self._log_level in self.LOG_LEVEL_DEBUG:
1224
+ if self._log_level == 'DEBUG':
1187
1225
  duration = time.time() - start
1188
1226
  self._debug(f"_retry duration for action '{action}': {duration:.2f}s")
1189
1227
 
@@ -14,28 +14,27 @@ class _WindowsKeywords(KeywordGroup):
14
14
  super().__init__()
15
15
 
16
16
  # Public
17
- def appium_hover(self, locator, start_locator=None, timeout=20, **kwargs):
17
+ def appium_hover(self, locator, start_locator=None, timeout=None, **kwargs):
18
18
  self._info(f"Appium Hover '{locator}', timeout '{timeout}'")
19
19
  self._appium_hover_api(start_locator=start_locator, end_locator=locator, timeout=timeout, **kwargs)
20
20
 
21
- def appium_click_offset(self, locator, x_offset=0, y_offset=0, timeout=20, **kwargs):
22
- self._info(
23
- f"Appium Click Offset '{locator}', (x_offset,y_offset) '({x_offset},{y_offset})', timeout '{timeout}'")
21
+ def appium_click_offset(self, locator, x_offset=0, y_offset=0, timeout=None, **kwargs):
22
+ self._info(f"Appium Click Offset '{locator}', (x_offset,y_offset) '({x_offset},{y_offset})', timeout '{timeout}'")
24
23
  self._appium_click_api(locator=locator, timeout=timeout, x_offset=x_offset, y_offset=y_offset, **kwargs)
25
24
 
26
- def appium_right_click(self, locator, timeout=20, **kwargs):
25
+ def appium_right_click(self, locator, timeout=None, **kwargs):
27
26
  self._info(f"Appium Right Click '{locator}', timeout '{timeout}'")
28
27
  self._appium_click_api(locator=locator, timeout=timeout, button="right", **kwargs)
29
28
 
30
- def appium_left_click(self, locator, timeout=20, **kwargs):
29
+ def appium_left_click(self, locator, timeout=None, **kwargs):
31
30
  self._info(f"Appium Left Click '{locator}', timeout '{timeout}'")
32
31
  self._appium_click_api(locator=locator, timeout=timeout, button="left", **kwargs)
33
32
 
34
- def appium_double_click(self, locator, timeout=20, **kwargs):
33
+ def appium_double_click(self, locator, timeout=None, **kwargs):
35
34
  self._info(f"Appium Double Click '{locator}', timeout '{timeout}'")
36
35
  self._appium_click_api(locator=locator, timeout=timeout, times=2, **kwargs)
37
36
 
38
- def appium_drag_and_drop(self, start_locator=None, end_locator=None, timeout=20, **kwargs):
37
+ def appium_drag_and_drop(self, start_locator=None, end_locator=None, timeout=None, **kwargs):
39
38
  self._info(f"Appium Drag And Drop '{start_locator} -> {end_locator}', timeout '{timeout}'")
40
39
  self._appium_drag_and_drop_api(start_locator=start_locator, end_locator=end_locator, timeout=timeout, **kwargs)
41
40
 
@@ -164,7 +163,7 @@ class _WindowsKeywords(KeywordGroup):
164
163
 
165
164
  self._apply_modifier_keys(click_params, kwargs.get("modifierKeys"))
166
165
 
167
- def _action():
166
+ def func():
168
167
  elements = self._element_find(locator, False, False)
169
168
  if not elements:
170
169
  raise Exception(f"Element not found: {locator}")
@@ -185,7 +184,14 @@ class _WindowsKeywords(KeywordGroup):
185
184
  driver.execute_script("windows: click", click_params)
186
185
  time.sleep(0.5)
187
186
 
188
- self._retry(_action, timeout, f"Failed to perform click action on '{locator}'")
187
+ self._retry(
188
+ timeout,
189
+ func,
190
+ action=f"Failed to perform click action on '{locator}'",
191
+ required=kwargs.pop("required", True),
192
+ return_value=kwargs.pop("return_value", True),
193
+ poll_interval=kwargs.pop("poll_interval", None)
194
+ )
189
195
 
190
196
  def _appium_hover_api(self, start_locator, end_locator, timeout, **kwargs):
191
197
  """
@@ -201,13 +207,15 @@ class _WindowsKeywords(KeywordGroup):
201
207
 
202
208
  self._apply_modifier_keys(hover_params, kwargs.get("modifierKeys"))
203
209
 
204
- def _action():
210
+ def func():
205
211
  if start_locator:
206
212
  start_element = self._element_find(start_locator, True, False)
207
213
  if start_element:
208
214
  hover_params["startElementId"] = start_element.id
209
215
  hover_params.pop("startX", None)
210
216
  hover_params.pop("startY", None)
217
+ else:
218
+ raise Exception(f"Start element not found: {start_locator}")
211
219
 
212
220
  if end_locator:
213
221
  end_element = self._element_find(end_locator, True, False)
@@ -215,11 +223,20 @@ class _WindowsKeywords(KeywordGroup):
215
223
  hover_params["endElementId"] = end_element.id
216
224
  hover_params.pop("endX", None)
217
225
  hover_params.pop("endY", None)
226
+ else:
227
+ raise Exception(f"End element not found: {end_locator}")
218
228
 
219
229
  self._current_application().execute_script("windows: hover", hover_params)
220
230
  time.sleep(0.5)
221
231
 
222
- self._retry(_action, timeout, "Failed to perform hover action")
232
+ self._retry(
233
+ timeout,
234
+ func,
235
+ action="Failed to perform hover action",
236
+ required=kwargs.pop("required", True),
237
+ return_value=kwargs.pop("return_value", True),
238
+ poll_interval=kwargs.pop("poll_interval", None)
239
+ )
223
240
 
224
241
  def _appium_drag_and_drop_api(self, start_locator, end_locator, timeout, **kwargs):
225
242
  """
@@ -236,7 +253,7 @@ class _WindowsKeywords(KeywordGroup):
236
253
 
237
254
  self._apply_modifier_keys(drag_params, kwargs.get("modifierKeys"))
238
255
 
239
- def _action():
256
+ def func():
240
257
  if start_locator:
241
258
  start_element = self._element_find(start_locator, True, False)
242
259
  if start_element:
@@ -254,7 +271,14 @@ class _WindowsKeywords(KeywordGroup):
254
271
  self._current_application().execute_script("windows: clickAndDrag", drag_params)
255
272
  time.sleep(0.5)
256
273
 
257
- self._retry(_action, timeout, "Failed to perform drag and drop action")
274
+ self._retry(
275
+ timeout,
276
+ func,
277
+ action="Failed to perform drag and drop action",
278
+ required=kwargs.pop("required", True),
279
+ return_value=kwargs.pop("return_value", True),
280
+ poll_interval=kwargs.pop("poll_interval", None)
281
+ )
258
282
 
259
283
  def _appium_keys_api(self, text, **kwargs):
260
284
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robotframework-appiumwindows
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Robot Framework AppiumLibrary extension for Windows desktop automation using NovaWindows2 Driver instead of WinAppDriver.
5
5
  Author-email: Huy Nguyen <nguyenvanhuy0612@gmail.com>
6
6
  License: MIT
@@ -3,21 +3,21 @@ AppiumLibrary/appium_path.py,sha256=fAsq8pY-Rknqxph0SS4qYQvZSvzKif5PV9XE9uz5Myw,
3
3
  AppiumLibrary/version.py,sha256=tiPfWbcvAi_f_6m9SWjLspGk6wtLrLIYPpARm5C07o4,41
4
4
  AppiumLibrary/keywords/__init__.py,sha256=j9ug8IsxoltsFwiYMvuk1lGWPzJdmrrG9btcmjgFYIE,746
5
5
  AppiumLibrary/keywords/_applicationmanagement.py,sha256=J0rDv8neQwX4tnmR7QdbfPPF9BxVyyq-hyK5gGzsuwk,22682
6
- AppiumLibrary/keywords/_element.py,sha256=AYZT9l8dditffpjbuYjN1edWSiwgmGnJICp8KZqAlHI,54872
6
+ AppiumLibrary/keywords/_element.py,sha256=QY-ASpNGrijOyXwku4FHHUHoa9ISNehtY86chQz9pjY,56159
7
7
  AppiumLibrary/keywords/_logging.py,sha256=07VoC1CYkCBWeEBeay-kpBHhES-uIb5g6_B7kXf1IHI,1864
8
8
  AppiumLibrary/keywords/_powershell.py,sha256=dFz_LVbewZ3F3RzDwk4Py8BMSm05XnpojczcYJ2eiaQ,24151
9
9
  AppiumLibrary/keywords/_runonfailure.py,sha256=dsy0qAyvoRFbnLy1lZgwadnFrKoFRh8hwTmRHocoz40,2847
10
10
  AppiumLibrary/keywords/_screenrecord.py,sha256=ND1BQXt14uXbnknCNU2l4Wzna5abIUGU1l8FHM6dqZs,6789
11
11
  AppiumLibrary/keywords/_screenshot.py,sha256=K5JJciCLOYbuSGzY5OErxL1Kc9tJX16GhqztdAzw32o,3747
12
12
  AppiumLibrary/keywords/_waiting.py,sha256=GvX2Yn88zX_1rrl-MEADgx62wXUm08m8E04fcDlSLls,6265
13
- AppiumLibrary/keywords/_windows.py,sha256=wxlZhU5xJm_Y0j8Rv0qYVP_UnHpcLetPZSeK_f74ZZA,11788
13
+ AppiumLibrary/keywords/_windows.py,sha256=jqOnRA3bcVdEBT3nxXK_V1ozzNxrwX-YJaahylXx3Mw,12643
14
14
  AppiumLibrary/keywords/keywordgroup.py,sha256=nd7zhoqodlG4E7-smySMGbK6e1cV9AjI0FAxr4YncMc,2467
15
15
  AppiumLibrary/locators/__init__.py,sha256=XtTYoS3PKdGSjZIR7fvaaK-ExaOh8ZWW2dddNBL419c,102
16
16
  AppiumLibrary/locators/elementfinder.py,sha256=acwAJ2OJsN59yJ5201UH5GdRgWJIzEj5Cc-xCgHTJW8,10977
17
17
  AppiumLibrary/utils/__init__.py,sha256=kFiEGeyc2IJVA1nUx2DezPkkO7HWTDnoL__gW4nRRlw,1572
18
18
  AppiumLibrary/utils/applicationcache.py,sha256=YrRQgz-4d77hToib4ApBjFT5VohO65DMNiNVUr_PI_0,1523
19
- robotframework_appiumwindows-0.1.4.dist-info/licenses/LICENSE,sha256=0usw_6IO4DLz-QIR_RLmRq9n4JX_Yns3Ew6dO-2FQmc,1070
20
- robotframework_appiumwindows-0.1.4.dist-info/METADATA,sha256=KhKi9I648go1eRtQc-PBgAihtNCOHScpV7vwwrK-Y8U,10256
21
- robotframework_appiumwindows-0.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
22
- robotframework_appiumwindows-0.1.4.dist-info/top_level.txt,sha256=2o2iQDagXnzsewODgcttx95vTzvaYaZB7q6KJB8sf-I,14
23
- robotframework_appiumwindows-0.1.4.dist-info/RECORD,,
19
+ robotframework_appiumwindows-0.1.6.dist-info/licenses/LICENSE,sha256=0usw_6IO4DLz-QIR_RLmRq9n4JX_Yns3Ew6dO-2FQmc,1070
20
+ robotframework_appiumwindows-0.1.6.dist-info/METADATA,sha256=s2sT6_7GhIHMtZVkitHeRx2eaQ484U4zo3Xc9LVK5GU,10256
21
+ robotframework_appiumwindows-0.1.6.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
22
+ robotframework_appiumwindows-0.1.6.dist-info/top_level.txt,sha256=2o2iQDagXnzsewODgcttx95vTzvaYaZB7q6KJB8sf-I,14
23
+ robotframework_appiumwindows-0.1.6.dist-info/RECORD,,