QWeb 3.4.0__tar.gz → 3.4.2__tar.gz

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.
Files changed (83) hide show
  1. {QWeb-3.4.0 → qweb-3.4.2}/PKG-INFO +21 -3
  2. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/__main__.py +2 -2
  3. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/_version.py +3 -3
  4. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/frame.py +4 -4
  5. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/icon.py +44 -50
  6. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/text.py +56 -13
  7. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/element.py +10 -4
  8. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/lists.py +1 -1
  9. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/table.py +30 -0
  10. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/text.py +11 -5
  11. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/PKG-INFO +21 -3
  12. {QWeb-3.4.0 → qweb-3.4.2}/README.md +1 -1
  13. {QWeb-3.4.0 → qweb-3.4.2}/setup.py +0 -1
  14. {QWeb-3.4.0 → qweb-3.4.2}/LICENSE +0 -0
  15. {QWeb-3.4.0 → qweb-3.4.2}/MANIFEST.in +0 -0
  16. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/__init__.py +0 -0
  17. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/custom_config.py +0 -0
  18. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/__init__.py +0 -0
  19. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/actions.py +0 -0
  20. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/ajax.py +0 -0
  21. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/alert.py +0 -0
  22. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/blocks.py +0 -0
  23. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/__init__.py +0 -0
  24. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/android.py +0 -0
  25. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/bs_desktop.py +0 -0
  26. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/bs_mobile.py +0 -0
  27. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/chrome.py +0 -0
  28. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/edge.py +0 -0
  29. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/firefox.py +0 -0
  30. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/browser/safari.py +0 -0
  31. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/checkbox.py +0 -0
  32. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/config.py +0 -0
  33. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/config_defaults.py +0 -0
  34. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/cookies.py +0 -0
  35. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/decorators.py +0 -0
  36. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/download.py +0 -0
  37. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/dragdrop.py +0 -0
  38. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/dropdown.py +0 -0
  39. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/element.py +0 -0
  40. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/exceptions.py +0 -0
  41. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/file.py +0 -0
  42. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/frame_checker.py +0 -0
  43. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/input_.py +0 -0
  44. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/input_handler.py +0 -0
  45. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/javascript.py +0 -0
  46. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/lists.py +0 -0
  47. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/meas.py +0 -0
  48. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/platform.py +0 -0
  49. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/screenshot.py +0 -0
  50. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/search_strategy.py +0 -0
  51. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/secrets.py +0 -0
  52. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/table.py +0 -0
  53. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/user.py +0 -0
  54. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/util.py +0 -0
  55. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/window.py +0 -0
  56. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/internal/xhr.py +0 -0
  57. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/__init__.py +0 -0
  58. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/ajax.py +0 -0
  59. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/alert.py +0 -0
  60. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/blocks.py +0 -0
  61. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/browser.py +0 -0
  62. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/checkbox.py +0 -0
  63. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/config.py +0 -0
  64. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/cookies.py +0 -0
  65. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/debug.py +0 -0
  66. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/download.py +0 -0
  67. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/dragdrop.py +0 -0
  68. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/dropdown.py +0 -0
  69. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/file.py +0 -0
  70. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/frame.py +0 -0
  71. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/icon.py +0 -0
  72. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/input_.py +0 -0
  73. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/javascript.py +0 -0
  74. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/screenshot.py +0 -0
  75. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/search_strategy.py +0 -0
  76. {QWeb-3.4.0 → qweb-3.4.2}/QWeb/keywords/window.py +0 -0
  77. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/SOURCES.txt +0 -0
  78. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/dependency_links.txt +0 -0
  79. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/not-zip-safe +0 -0
  80. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/requires.txt +0 -0
  81. {QWeb-3.4.0 → qweb-3.4.2}/QWeb.egg-info/top_level.txt +0 -0
  82. {QWeb-3.4.0 → qweb-3.4.2}/setup.cfg +0 -0
  83. {QWeb-3.4.0 → qweb-3.4.2}/versioneer.py +0 -0
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QWeb
3
- Version: 3.4.0
3
+ Version: 3.4.2
4
4
  Summary: Keyword driven automation for the web
5
5
  Home-page: https://github.com/qentinelqi/qweb/
6
6
  Author: Copado Inc.
7
7
  Author-email: copadorobotictesting@copado.com
8
8
  License: Apache License 2.0
9
9
  Keywords: test automation robot framework
10
- Classifier: Programming Language :: Python :: 3.8
11
10
  Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
@@ -18,6 +17,25 @@ Classifier: Framework :: Robot Framework :: Library
18
17
  Requires-Python: >3.7,<4.0
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE
20
+ Requires-Dist: setuptools>=70.0.0
21
+ Requires-Dist: pyscreeze==0.1.28
22
+ Requires-Dist: pyautogui>=0.9.53
23
+ Requires-Dist: pynput>=1.7.7
24
+ Requires-Dist: requests>=2.32.2
25
+ Requires-Dist: robotframework<8,>=4.1.3
26
+ Requires-Dist: robotframework-debuglibrary==2.5.0
27
+ Requires-Dist: selenium<5,>=4.16.0
28
+ Requires-Dist: Pillow<11,>=10.3.0
29
+ Requires-Dist: scipy>=1.7.3
30
+ Requires-Dist: scikit-image==0.21; python_version == "3.8"
31
+ Requires-Dist: scikit-image==0.24; python_version > "3.8"
32
+ Requires-Dist: ply
33
+ Requires-Dist: numpy<2,>=1.23.5
34
+ Requires-Dist: opencv-python==4.8.1.78
35
+ Requires-Dist: slate3k>=0.5.3
36
+ Requires-Dist: xlib; "linux" in sys_platform
37
+ Requires-Dist: pyobjc-core>=9.2; "darwin" in sys_platform
38
+ Requires-Dist: pyobjc>=9.2; "darwin" in sys_platform
21
39
 
22
40
  <img id="qweb" src="https://github.com/qentinelqi/qweb/raw/master/images/qweb.png" alt="QWeb">
23
41
 
@@ -80,7 +98,7 @@ See [examples](#examples).
80
98
 
81
99
  ---
82
100
  ## Requirements
83
- Python **3.8-3.11** and Robot Framework 4.1.3 or above.
101
+ Python **3.9-3.12** and Robot Framework 4.1.3 or above.
84
102
 
85
103
  (Note that support on Macs with Apple based silicon (M1) requires MacOS version 12/Monterey or above or [custom installation](https://github.com/qentinelqi/qweb/blob/master/docs/qweb_mac_m1_installation.md).)
86
104
 
@@ -26,9 +26,9 @@ def cli() -> None:
26
26
  usage="python %(prog)s [options] INPUT"
27
27
  "\n\nEXAMPLES:\n"
28
28
  "%(prog)s --all (lists all keywords)\n"
29
- '%(prog)s --list Get (lists all keywords startin with "Get")\n'
29
+ '%(prog)s --list Get (lists all keywords starting with "Get")\n'
30
30
  '%(prog)s --show TypeText (displays documentation for keyword "TypeText")',
31
- description="Note: This module is meant to be used as a robot famework library."
31
+ description="Note: This module is meant to be used as a robot framework library."
32
32
  "Command line interface only provides access to keyword documentation.",
33
33
  )
34
34
  parser.add_argument(
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-08-22T09:48:50+0300",
11
+ "date": "2024-10-23T13:39:11+0300",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "f1673956e04b38acaf9db52bbaec1ac4645fe0e8",
15
- "version": "v3.4.0"
14
+ "full-revisionid": "04bc5d6d0ee82296341ec880141c7574d5e8110e",
15
+ "version": "v3.4.2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -15,7 +15,7 @@
15
15
  # limitations under the License.
16
16
  # ---------------------------
17
17
  from __future__ import annotations
18
- from typing import Optional, Callable, Any, Union
18
+ from typing import Optional, Callable, Any, Union, List
19
19
  import os
20
20
  import time
21
21
  from functools import wraps
@@ -181,14 +181,14 @@ def all_frames(fn: Callable[..., Any]) -> Callable[..., Any]:
181
181
  """
182
182
 
183
183
  @wraps(fn)
184
- def wrapped(*args, **kwargs) -> Callable[..., Any]:
184
+ def wrapped(*args, **kwargs) -> Union[Callable[..., Any], List[Any], Any]:
185
185
  # Default behavior is not to continue searching
186
186
  continue_search = kwargs.get("continue_search", False)
187
187
 
188
188
  # pylint: disable=too-many-branches
189
189
  def search_from_frames(
190
190
  driver: Optional[WebDriver] = None, current_frame: Optional[WebElement] = None
191
- ) -> Callable[..., Any]:
191
+ ) -> Union[List[Any], Any]:
192
192
  # Initialize the list to store found elements if continue_search is True
193
193
  all_elements = []
194
194
  keep_frame = kwargs.get("stay_in_current_frame", CONFIG["StayInCurrentFrame"])
@@ -259,7 +259,7 @@ def all_frames(fn: Callable[..., Any]) -> Callable[..., Any]:
259
259
  driver: Optional[WebDriver] = None,
260
260
  current_frame: Union[Optional[WebElement], int] = None,
261
261
  parent_tree: list[Union[WebElement, int]] = [],
262
- ) -> Callable[..., Any]:
262
+ ) -> Union[List[Any], Any]:
263
263
  # Initialize the list to store found elements if continue_search is True
264
264
  all_elements = []
265
265
  keep_frame = kwargs.get("stay_in_current_frame", CONFIG["StayInCurrentFrame"])
@@ -30,6 +30,7 @@ from QWeb.internal.screenshot import (
30
30
  SCREEN_SHOT_DIR_NAME,
31
31
  )
32
32
  from QWeb.internal.config_defaults import CONFIG
33
+ from robot.api import logger
33
34
  from uuid import uuid4
34
35
 
35
36
 
@@ -100,7 +101,7 @@ class QIcon:
100
101
  image_obj = Image as uint8 NumPy array in RGB color space.
101
102
  level = Image pyramid size - how many times the image is up- and downsampled.
102
103
  """
103
- print("*INFO* Start _get_image_pyramid")
104
+ logger.info("Start _get_image_pyramid")
104
105
  image_levels = []
105
106
  if level == 0:
106
107
  image_levels.append((image_obj, 1.0))
@@ -117,7 +118,7 @@ class QIcon:
117
118
  # scales.append(1.0 + 0.03 * i)
118
119
  # scales.append(1.0)
119
120
  # scales.sort()
120
- print("*DEBUG* Scales: {}".format(scales))
121
+ logger.debug(f"Scales: {scales}")
121
122
  for scale in scales:
122
123
  if scale <= 0:
123
124
  continue
@@ -177,8 +178,8 @@ class QIcon:
177
178
  width, height = self._get_image_size(template)
178
179
  img_width, img_height = self._get_image_size(image_obj)
179
180
 
180
- print("*DEBUG* source haystack (image_obj) image size: {}x{}".format(img_width, img_height))
181
- print("*DEBUG* original needle (template) image size: {}x{}".format(width, height))
181
+ logger.debug(f"source haystack (image_obj) image size: {img_width}x{img_height}")
182
+ logger.debug(f"original needle (template) image size: {width}x{height}")
182
183
 
183
184
  if height > img_height or width > img_width:
184
185
  raise ValueError(
@@ -187,7 +188,7 @@ class QIcon:
187
188
  width, height, img_width, img_height
188
189
  )
189
190
  )
190
- print("*DEBUG* Resampling by 16 levels for needle, 0 levels for haystack")
191
+ logger.debug("Resampling by 16 levels for needle, 0 levels for haystack")
191
192
 
192
193
  # temp = image_obj
193
194
  # image_obj = template
@@ -196,7 +197,6 @@ class QIcon:
196
197
  MEAS.start("RESAMPLING TIME (_get_image_pyramid)")
197
198
  template_levels = self._get_image_pyramid(template, 16)
198
199
  MEAS.stop()
199
- print("*DEBUG* Test print")
200
200
  # template_levels = self._get_image_pyramid(template, 0)
201
201
  # image_levels = self._get_image_pyramid(image_obj, level)
202
202
  image_levels = self._get_image_pyramid(image_obj, 0)
@@ -207,30 +207,24 @@ class QIcon:
207
207
  best_scale = 0.0
208
208
  best_matched_image: ndarray # = None
209
209
 
210
- print("*DEBUG* Different resamplings used: " + str(len(template_levels)))
211
- # for template_level in template_levels:
212
- # w, h = self._get_image_size(template_level)
213
- # print("template_level image size: {}x{}".format(w, h))
210
+ logger.debug(f"Different resamplings used: {str(len(template_levels))} ")
214
211
 
215
212
  MEAS.start("WHOLE TEMPLATE MATCHING AND POINT EXTRACTION TIME")
216
213
  for template_level in template_levels:
217
214
  w, h = self._get_image_size(template_level[0])
218
- print(
219
- "*DEBUG* Resampled needle (template_level) with scale {}, "
220
- "image size: {}x{}".format(template_level[1], w, h)
215
+ logger.debug(
216
+ f"Resampled needle (template_level) with scale {template_level[1]},"
217
+ "image size: {w}x{h}"
221
218
  )
222
219
  MEAS.start("CV2.MATCHTEMPLATE TIME")
223
220
  res = cv2.matchTemplate(image_levels[0][0], template_level[0], cv2.TM_CCOEFF_NORMED)
224
221
  MEAS.stop()
225
- # print("did matchTemplate, res:\n")
226
- # print(res)
227
222
  MEAS.start("EXTRACT POINTS TIME")
228
223
  current_points, highest_max_val, highest_max_val_loc = self._extract_points(
229
224
  h, res, threshold, w
230
225
  )
231
226
  MEAS.stop()
232
- # print("did extract_points, points:\n")
233
- # print(current_points)
227
+
234
228
  if highest_max_val > best_highest_max_val:
235
229
  best_highest_max_val = highest_max_val
236
230
  best_highest_max_val_loc = highest_max_val_loc
@@ -244,27 +238,20 @@ class QIcon:
244
238
  if points:
245
239
  points.sort(key=lambda coord: (coord[1], coord[0]))
246
240
  else:
247
- print(
248
- "*INFO* Template image not found. "
249
- "Closest match threshold value {} found at {}, {}. "
250
- "Threshold used: {}".format(
251
- best_highest_max_val,
252
- best_highest_max_val_loc[0],
253
- best_highest_max_val_loc[1],
254
- threshold,
255
- )
256
- )
257
- print(
258
- "*INFO* Closest match threshold value {} found at {}, {}.\n"
259
- "Threshold used: {}\n"
260
- "Scale with best result: {}".format(
261
- best_highest_max_val,
262
- best_highest_max_val_loc[0],
263
- best_highest_max_val_loc[1],
264
- threshold,
265
- best_scale,
241
+ logger.info(
242
+ "Template image not found. "
243
+ f"Closest match threshold value {best_highest_max_val} found at "
244
+ f"{best_highest_max_val_loc[0]}, {best_highest_max_val_loc[1]}. "
245
+ f"Threshold used: {threshold}"
266
246
  )
247
+
248
+ logger.info(
249
+ f"Closest match threshold value {best_highest_max_val} "
250
+ f"found at {best_highest_max_val_loc[0]}, {best_highest_max_val_loc[1]}.\n"
251
+ f"Threshold used: {threshold}\n"
252
+ f"Scale with best result: {best_scale}"
267
253
  )
254
+
268
255
  self._log_matched_image(
269
256
  color_image_obj,
270
257
  color_template,
@@ -272,9 +259,10 @@ class QIcon:
272
259
  best_highest_max_val_loc,
273
260
  best_scale,
274
261
  )
275
- print("*DEBUG {}".format(points))
262
+ logger.debug(f"*DEBUG {points}")
276
263
  return points
277
264
 
265
+ # pylint: disable=too-many-branches, too-many-statements
278
266
  def image_location(
279
267
  self,
280
268
  needle: str,
@@ -293,7 +281,7 @@ class QIcon:
293
281
  Draw function will plot red lines where needle image is found.
294
282
  """
295
283
 
296
- print("*INFO* _image_location Starts")
284
+ logger.info("_image_location Starts")
297
285
 
298
286
  image = cv2.imread(haystack)
299
287
  image_haystack = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) if grayscale else image
@@ -314,18 +302,18 @@ class QIcon:
314
302
  height, width = template.shape[:2]
315
303
 
316
304
  scale_ratios = self._get_scale_ratios(template_res_w, device_res_w)
317
- print(f"*DEBUG* Scale ratios to be used in order: {scale_ratios}")
305
+ logger.debug(f"Scale ratios to be used in order: {scale_ratios}")
318
306
 
319
307
  best_highest_max_val = 0.0
320
308
  best_highest_max_val_loc = (-1, -1)
321
309
  best_scale_ratio: float # = None
322
310
  best_matched_image: ndarray # = None
323
311
 
324
- print("*DEBUG* Resampling loop Starts")
312
+ logger.debug("Resampling loop Starts")
325
313
  for scale_ratio in scale_ratios:
326
314
  interpolation_method = cv2.INTER_LINEAR if scale_ratio > 1.0 else cv2.INTER_AREA
327
315
 
328
- print(f"*DEBUG* resize starts: for scale {scale_ratio}")
316
+ logger.debug(f"resize starts: for scale {scale_ratio}")
329
317
 
330
318
  if math.isclose(scale_ratio, 1.0, rel_tol=0.03):
331
319
  scaled_img_template = template
@@ -337,7 +325,7 @@ class QIcon:
337
325
  fy=scale_ratio,
338
326
  interpolation=interpolation_method,
339
327
  )
340
- print("*DEBUG* matchTemplate Starts:")
328
+ logger.debug("matchTemplate Starts:")
341
329
 
342
330
  res = cv2.matchTemplate(image_haystack, scaled_img_template, cv2.TM_CCOEFF_NORMED)
343
331
 
@@ -348,7 +336,7 @@ class QIcon:
348
336
  elif ratio < 1.1:
349
337
  ratio = 1.0
350
338
 
351
- print("*DEBUG* _extract_points Starts:")
339
+ logger.debug("_extract_points Starts:")
352
340
  (
353
341
  _current_points,
354
342
  highest_max_val,
@@ -363,8 +351,8 @@ class QIcon:
363
351
 
364
352
  best_scale_ratio = scale_ratio
365
353
  best_matched_image = scaled_img_template
366
- print(
367
- f"*DEBUG* Current best match location: {best_highest_max_val_loc},\n"
354
+ logger.debug(
355
+ f"Current best match location: {best_highest_max_val_loc},\n"
368
356
  f"max_value: {best_highest_max_val},\n"
369
357
  f"scale_ratio: {best_scale_ratio}"
370
358
  )
@@ -384,9 +372,15 @@ class QIcon:
384
372
  cv2.imwrite("temp_matched_area.png", image)
385
373
  break
386
374
 
387
- print("*DEBUG* Ready to return points:")
388
- print(
389
- f"*DEBUG* Best match location: {best_highest_max_val_loc}, "
375
+ # No match found, set to a default scale ratio and original image
376
+ if best_highest_max_val == 0.0:
377
+ best_scale_ratio = 1.00
378
+ best_matched_image = template
379
+ logger.debug("No matching found, returning original image")
380
+
381
+ logger.debug("Ready to return points:")
382
+ logger.debug(
383
+ f"Best match location: {best_highest_max_val_loc}, "
390
384
  f"best correlation value: {best_highest_max_val}, best scale ratio: {best_scale_ratio}"
391
385
  )
392
386
  self._log_matched_image(
@@ -453,8 +447,8 @@ class QIcon:
453
447
  else:
454
448
  break
455
449
 
456
- print(
457
- f"*DEBUG* Extracted points.\nCoordinate ratio was {coordinate_ratio}"
450
+ logger.debug(
451
+ f"Extracted points.\nCoordinate ratio was {coordinate_ratio}"
458
452
  f"\nHighest max value was {highest_max_val}"
459
453
  f"\nHighest max value location was {highest_max_val_loc}"
460
454
  f"\nAll points: {points}"
@@ -93,7 +93,9 @@ def find_text(text: str) -> bool:
93
93
 
94
94
 
95
95
  def get_text_elements(text: str, **kwargs) -> Optional[list[WebElement]]:
96
- web_elements: Optional[list[WebElement]]
96
+ web_elements: Optional[list[WebElement]] = None
97
+ xpath_elements: Optional[list[WebElement]] = None
98
+ slot_elements: Optional[list[WebElement]] = None
97
99
  try:
98
100
  web_elements = _get_exact_text_element(text, **kwargs)
99
101
  except NoSuchFrameException:
@@ -104,6 +106,14 @@ def get_text_elements(text: str, **kwargs) -> Optional[list[WebElement]]:
104
106
  web_elements = _get_contains_text_element(text, **kwargs)
105
107
  except NoSuchFrameException:
106
108
  logger.debug("Got no such frame from contains text")
109
+ # find text directly from slots with supported parent elements
110
+ slot_elements = get_slot_elements(text, partial)
111
+ if slot_elements:
112
+ xpath_elements = element.get_visible_elements_from_elements(slot_elements, **kwargs) or None
113
+ if xpath_elements:
114
+ if web_elements is None:
115
+ web_elements = [] # Initialize web_elements to an empty list if it's None
116
+ web_elements = web_elements + xpath_elements
107
117
  shadow_dom = CONFIG["ShadowDOM"]
108
118
  if shadow_dom:
109
119
  shadow_elements = get_texts_including_shadow_dom(text, partial, **kwargs)
@@ -111,6 +121,7 @@ def get_text_elements(text: str, **kwargs) -> Optional[list[WebElement]]:
111
121
  web_elements = util.remove_stale_elements(web_elements) # type: ignore
112
122
  # remove duplicates
113
123
  web_elements = util.remove_duplicates_from_list(shadow_elements, web_elements) # type: ignore # pylint: disable=C0301
124
+
114
125
  return web_elements
115
126
 
116
127
 
@@ -397,6 +408,8 @@ def _get_item_by_css(text: str, **kwargs) -> Optional[list[WebElement]]:
397
408
  "a, span, img, li, h1, h2, h3, h4, h5, h6, div, svg, p, button, input"
398
409
  ':not([type="text"]):not([type="password"]):not([type="email"])'
399
410
  )
411
+ # get_elements_by_attributes already handles going through frames
412
+ kwargs["continue_search"] = False
400
413
  full, partial = element.get_elements_by_attributes(css, text, **kwargs)
401
414
  web_elements = element.get_visible_elements_from_elements(full + partial, **kwargs)
402
415
  if web_elements:
@@ -427,6 +440,46 @@ def _get_anchor_with_inner_text(
427
440
  return None
428
441
 
429
442
 
443
+ def get_slot_elements(locator: str,
444
+ partial_match: bool = False) -> Optional[list[WebElement]]:
445
+ """
446
+ Retrieve text from supported slot elements based on a locator string. Slots are by default
447
+ not visible (no offset), but some systems like Salesforce put texts directly in slots.
448
+ This function allows to retrieve these elements, if text is directly in a slot which is
449
+ a child element to a visible <a> element. The returned element is the parent element.
450
+
451
+ Args:
452
+ locator (str): The string to locate elements by.
453
+ partial_match (bool): Whether to use partial matching.
454
+
455
+ Returns:
456
+ Optional[List[WebElement]]: List of clickable WebElement objects, or None if none found.
457
+ """
458
+ # slots with matching direct text with parent <a> are currently supported
459
+ if partial_match:
460
+ xpath = (
461
+ '//a[descendant::slot[contains('
462
+ 'normalize-space(translate(., "\u00a0", " ")), '
463
+ f'"{locator}")]]'
464
+ )
465
+ else:
466
+ xpath = f'//a[descendant::slot[normalize-space(translate(., "\u00a0", " "))="{locator}"]]'
467
+
468
+ # handle quotes
469
+ xpath = xpath.replace(f'"{locator}"', util.escape_xpath_quotes(locator))
470
+
471
+ # Find slots with text and get/return their parent link
472
+ driver = browser.get_current_browser()
473
+
474
+ # if any other weird characters or combinations that might break xpath,
475
+ # return None instead of throwing an exception
476
+ try:
477
+ xpath_elements = driver.find_elements(By.XPATH, xpath)
478
+ except InvalidSelectorException:
479
+ return None
480
+ return xpath_elements
481
+
482
+
430
483
  @frame.all_frames
431
484
  def get_clickable_elements(
432
485
  locator: str, shadow_dom: bool = False, **kwargs
@@ -445,19 +498,9 @@ def get_clickable_elements(
445
498
  """
446
499
  partial = util.par2bool(kwargs.get("partial_match", False))
447
500
 
448
- # find parent <a> from slots with direct text
449
- if partial:
450
- xpath = (
451
- "//a[descendant::slot[contains("
452
- "normalize-space(translate(., '\u00a0', ' ')), "
453
- f"'{locator}')]]"
454
- )
455
- else:
456
- xpath = f"//a[descendant::slot[normalize-space(translate(., '\u00a0', ' '))='{locator}']]"
501
+ # Find text directly in slots with supported parent elements
502
+ xpath_elements = get_slot_elements(locator, partial)
457
503
 
458
- # Find slots with text and get their parent link
459
- driver = browser.get_current_browser()
460
- xpath_elements = driver.find_elements(By.XPATH, xpath)
461
504
  # Find normal elements via javascript
462
505
  if shadow_dom:
463
506
  js_elements = javascript.get_clickable_from_shadow_dom(locator, partial)
@@ -24,6 +24,7 @@ from selenium.webdriver.support.select import Select
24
24
  from robot.api.deco import keyword
25
25
  from QWeb.internal.exceptions import QWebValueError, QWebElementNotFoundError
26
26
  from QWeb.internal import element, decorators, actions, text, input_, dropdown, checkbox
27
+ from QWeb.internal.config_defaults import CONFIG
27
28
 
28
29
 
29
30
  @keyword(tags=["Interaction"])
@@ -65,7 +66,7 @@ def click_element(
65
66
  ----------
66
67
  xpath : str | selenium.webdriver.remote.webelement.WebElement
67
68
  Xpath expression with or without xpath= prefix. The equal sign "=" must be escaped
68
- with a "\".
69
+ with a "\\".
69
70
  Can also be a WebElement instance returned by GetWebElement keyword or javascript.
70
71
  timeout : int
71
72
  How long we wait before failing.
@@ -123,7 +124,7 @@ def right_click(
123
124
  ----------
124
125
  xpath : str
125
126
  Xpath expression with or without xpath= prefix. The equal sign "=" must be escaped
126
- with a "\".
127
+ with a "\\".
127
128
  timeout : int
128
129
  How long we wait before failing.
129
130
  index : int
@@ -170,7 +171,7 @@ def hover_element(
170
171
  ----------
171
172
  xpath : str | selenium.webdriver.remote.webelement.WebElement
172
173
  Xpath expression with or without xpath= prefix. The equal sign "=" must be escaped
173
- with a "\".
174
+ with a "\\".
174
175
  Can also be a WebElement instance returned by GetWebElement keyword or javascript.
175
176
  timeout : int
176
177
  How long we wait before failing.
@@ -229,7 +230,7 @@ def get_element_count(
229
230
  ----------
230
231
  locator : str
231
232
  Xpath or some attribute value of element. When using XPaths, the equal sign "=" must be
232
- escaped with a "\".
233
+ escaped with a "\\".
233
234
  timeout : str | int
234
235
  How long we try to find text before failing. Default 10 (seconds)
235
236
  Accepted kwargs:
@@ -351,6 +352,8 @@ def verify_element(xpath: str, timeout: Union[int, float, str] = 0, **kwargs) ->
351
352
  else:
352
353
  web_elements = element.get_webelements(xpath, **kwargs)
353
354
  if web_elements:
355
+ if CONFIG["SearchMode"]:
356
+ element.draw_borders(web_elements)
354
357
  return
355
358
  raise QWebElementNotFoundError("No matching element found")
356
359
 
@@ -620,6 +623,9 @@ def get_attribute(
620
623
  ----------------
621
624
  \`VerifyAttribute\`, \`VerifyElement\`
622
625
  """
626
+ # remove all_frames from kwargs if given. It's not supported by
627
+ # GetAttribute, but would give error later
628
+ kwargs.pop("all_frames", None)
623
629
  webelement = get_webelement(locator, anchor, element_type, timeout, all_frames=False, **kwargs)
624
630
 
625
631
  if not webelement:
@@ -72,7 +72,7 @@ def use_list(
72
72
  xpath can be used to locate correct list. If wanted list is multiple amount
73
73
  of whatever web elements with some common attribute, xpath can be used
74
74
  to select those elements. When using XPaths, the equal sign "=" must be
75
- escaped with a "\".
75
+ escaped with a "\\".
76
76
  anchor : str
77
77
  Index number or text near the locator element.
78
78
  If the page contains many places where the locator is then anchor is used
@@ -106,6 +106,8 @@ def verify_table(
106
106
  ) -> None:
107
107
  r"""Verify text in table coordinates.
108
108
 
109
+ A table must be focused with **UseTable** keyword before using this keyword.
110
+
109
111
  Reads cell value from **coordinates** in active table and verifies it
110
112
  against expected value.
111
113
 
@@ -131,10 +133,16 @@ def verify_table(
131
133
  **NOTE:** Index based search omits column headers (*<thead>*). Text based search
132
134
  (marked with "/") does not.
133
135
 
136
+ **NOTE2:** Since "/" is used as a separator in coordinate format, locator inside textual search
137
+ coordinates can't contain character "/". Use partial text in locator instead.
138
+
134
139
  Examples
135
140
  --------
136
141
  .. code-block:: robotframework
137
142
 
143
+ # Activate table
144
+ UseTable MyTable
145
+
138
146
  # Verify that row 2 column 3 contains "jane.doe@example.com"
139
147
  # Header row is omitted
140
148
  VerifyTable r2c3 jane.doe@example.com
@@ -197,6 +205,8 @@ def get_cell_text(
197
205
  ) -> Union[str, int, float]:
198
206
  r"""Get cell text to variable.
199
207
 
208
+ A table must be focused with **UseTable** keyword before using this keyword.
209
+
200
210
  Locates cell by coordinates from active table and return value.
201
211
 
202
212
  **Coordinate format**:
@@ -219,10 +229,14 @@ def get_cell_text(
219
229
  **NOTE:** Index based search omits column headers (*<thead>*). Text based search
220
230
  (marked with "/") does not.
221
231
 
232
+ **NOTE2:** Since "/" is used as a separator in coordinate format, locator inside textual search
233
+ coordinates can't contain character "/". Use partial text in locator instead.
234
+
222
235
  Examples
223
236
  --------
224
237
  .. code-block:: robotframework
225
238
 
239
+ UseTable MyTable
226
240
  ${value} GetCellText r2c3
227
241
  ${value} GetCellText r-2c5 #Row is second to last. Get value from cell c5
228
242
  ${value} GetCellText r?Robot/c5 #Row contains text Robot. Get value from cell c5
@@ -281,6 +295,9 @@ def click_cell(
281
295
  r"""Click table cell.
282
296
 
283
297
  Locates cell by coordinates or text from active table and clicks it.
298
+
299
+ A table must be focused with **UseTable** keyword before using this keyword.
300
+
284
301
  Note that by default click is sent to the cell element itself, so if you want
285
302
  to specify which child element is clicked, add tag argument.
286
303
 
@@ -305,10 +322,14 @@ def click_cell(
305
322
  **NOTE:** Index based search omits column headers (*<thead>*). Text based search
306
323
  (marked with "/") does not.
307
324
 
325
+ **NOTE2:** Since "/" is used as a separator in coordinate format, locator inside textual search
326
+ coordinates can't contain character "/". Use partial text in locator instead.
327
+
308
328
  Examples
309
329
  --------
310
330
  .. code-block:: robotframework
311
331
 
332
+ UseTable MyTable
312
333
  ClickCell r2c3
313
334
  ClickCell r-1c-1 #Last row, last cell
314
335
  ClickCell r?SomeText/c3 #Click cell 3 in row that contains text SomeText
@@ -369,6 +390,8 @@ def get_table_row(
369
390
  ) -> Union[WebElement, int]:
370
391
  r"""Get row (index) from current table.
371
392
 
393
+ A table must be focused with **UseTable** keyword before using this keyword.
394
+
372
395
  Get table row number by some visible text or value. Returned value is index of row
373
396
  including first header row, unless argument **skip_header=True** is used.
374
397
 
@@ -376,6 +399,7 @@ def get_table_row(
376
399
  --------
377
400
  .. code-block:: robotframework
378
401
 
402
+ UseTable MyTable
379
403
  ${row} GetTableRow //last #returns table length(last row)
380
404
  ${row} GetTableRow Qentinel #return first row which contain text Qentinel
381
405
  ${row} GetTableRow Qentinel 2 #second row with text Qentinel
@@ -412,6 +436,8 @@ def get_table_row(
412
436
  def get_col_header_count() -> int:
413
437
  r"""Get Count of column headers in current active table.
414
438
 
439
+ A table must be focused with **UseTable** keyword before using this keyword.
440
+
415
441
  Note: only visible columns may be counted in some dynamic tables.
416
442
 
417
443
  Examples
@@ -440,6 +466,8 @@ def get_col_header_count() -> int:
440
466
  def get_col_header(index: Optional[int] = None) -> Union[str, List[str]]:
441
467
  r"""Get column header names/text as a list.
442
468
 
469
+ A table must be focused with **UseTable** keyword before using this keyword.
470
+
443
471
  Note: only visible columns may be counted in some dynamic tables.
444
472
 
445
473
  Note2: If column header has attribute 'aria-label', it's value is returned.
@@ -503,6 +531,8 @@ def get_col_header(index: Optional[int] = None) -> Union[str, List[str]]:
503
531
  def verify_col_header(expected: str, index: Optional[int] = None, **kwargs) -> bool:
504
532
  r"""Verifies that a column header with given index matches the expected text.
505
533
 
534
+ A table must be focused with **UseTable** keyword before using this keyword.
535
+
506
536
  Note: only visible columns may be counted in some dynamic tables.
507
537
 
508
538
  Note2: If column header has attribute 'aria-label', it's value is considered as expected value.
@@ -66,21 +66,27 @@ def verify_text(
66
66
  VerifyText does not require for the text to be unique.
67
67
 
68
68
  *Note: Slots are a bit unique as they do not have size/offset. This means
69
- that our default visibility check will treat slots as not visible. If text is
70
- directly on the slot, use visibility=False argument in VerifyText keyword. For example:*
69
+ that our default visibility check will treat slots as not visible. The most common
70
+ case is that text is directly under slot, which is a direct child to a `a` tag. We
71
+ have made exception for this case and those texts will be found by default. However,
72
+ if you have text directly on slot which is not a direct child to a `<a>` tag, you need
73
+ to use visibility=False argument in VerifyText keyword. For example:*
71
74
 
72
75
  .. code-block:: html
73
76
 
74
- <slot>My Text</slot>
77
+ <p><slot>My Text</slot></p>
75
78
 
76
79
  *The above needs visibility=False argument, as text is directly on the slot. However,
77
- this one would work without turning visibility check off, since text is on a child
78
- element under slot:*
80
+ these would work without turning visibility check off:*
79
81
 
80
82
  .. code-block:: html
81
83
 
84
+ <!--text is on a child element under slot-->
82
85
  <slot><span>My Text</span></slot>
83
86
 
87
+ <!--text is on slot which is child element to a <a>-->
88
+ <a><slot>My Text</slot></a>
89
+
84
90
 
85
91
  Examples
86
92
  --------
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QWeb
3
- Version: 3.4.0
3
+ Version: 3.4.2
4
4
  Summary: Keyword driven automation for the web
5
5
  Home-page: https://github.com/qentinelqi/qweb/
6
6
  Author: Copado Inc.
7
7
  Author-email: copadorobotictesting@copado.com
8
8
  License: Apache License 2.0
9
9
  Keywords: test automation robot framework
10
- Classifier: Programming Language :: Python :: 3.8
11
10
  Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
@@ -18,6 +17,25 @@ Classifier: Framework :: Robot Framework :: Library
18
17
  Requires-Python: >3.7,<4.0
19
18
  Description-Content-Type: text/markdown
20
19
  License-File: LICENSE
20
+ Requires-Dist: setuptools>=70.0.0
21
+ Requires-Dist: pyscreeze==0.1.28
22
+ Requires-Dist: pyautogui>=0.9.53
23
+ Requires-Dist: pynput>=1.7.7
24
+ Requires-Dist: requests>=2.32.2
25
+ Requires-Dist: robotframework<8,>=4.1.3
26
+ Requires-Dist: robotframework-debuglibrary==2.5.0
27
+ Requires-Dist: selenium<5,>=4.16.0
28
+ Requires-Dist: Pillow<11,>=10.3.0
29
+ Requires-Dist: scipy>=1.7.3
30
+ Requires-Dist: scikit-image==0.21; python_version == "3.8"
31
+ Requires-Dist: scikit-image==0.24; python_version > "3.8"
32
+ Requires-Dist: ply
33
+ Requires-Dist: numpy<2,>=1.23.5
34
+ Requires-Dist: opencv-python==4.8.1.78
35
+ Requires-Dist: slate3k>=0.5.3
36
+ Requires-Dist: xlib; "linux" in sys_platform
37
+ Requires-Dist: pyobjc-core>=9.2; "darwin" in sys_platform
38
+ Requires-Dist: pyobjc>=9.2; "darwin" in sys_platform
21
39
 
22
40
  <img id="qweb" src="https://github.com/qentinelqi/qweb/raw/master/images/qweb.png" alt="QWeb">
23
41
 
@@ -80,7 +98,7 @@ See [examples](#examples).
80
98
 
81
99
  ---
82
100
  ## Requirements
83
- Python **3.8-3.11** and Robot Framework 4.1.3 or above.
101
+ Python **3.9-3.12** and Robot Framework 4.1.3 or above.
84
102
 
85
103
  (Note that support on Macs with Apple based silicon (M1) requires MacOS version 12/Monterey or above or [custom installation](https://github.com/qentinelqi/qweb/blob/master/docs/qweb_mac_m1_installation.md).)
86
104
 
@@ -59,7 +59,7 @@ See [examples](#examples).
59
59
 
60
60
  ---
61
61
  ## Requirements
62
- Python **3.8-3.11** and Robot Framework 4.1.3 or above.
62
+ Python **3.9-3.12** and Robot Framework 4.1.3 or above.
63
63
 
64
64
  (Note that support on Macs with Apple based silicon (M1) requires MacOS version 12/Monterey or above or [custom installation](https://github.com/qentinelqi/qweb/blob/master/docs/qweb_mac_m1_installation.md).)
65
65
 
@@ -30,7 +30,6 @@ setup(
30
30
  packages=find_packages(exclude=["*.test", "*.test.*", "test.*", "test"]),
31
31
 
32
32
  classifiers=[
33
- 'Programming Language :: Python :: 3.8',
34
33
  'Programming Language :: Python :: 3.9',
35
34
  'Programming Language :: Python :: 3.10',
36
35
  'Programming Language :: Python :: 3.11',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes