QWeb 3.2.0__tar.gz → 3.2.1__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.2.0 → QWeb-3.2.1}/PKG-INFO +1 -1
  2. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/_version.py +3 -3
  3. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/actions.py +7 -1
  4. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/input_handler.py +1 -1
  5. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/text.py +36 -3
  6. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/util.py +2 -2
  7. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/blocks.py +5 -1
  8. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/text.py +11 -4
  9. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/PKG-INFO +1 -1
  10. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/requires.txt +1 -1
  11. {QWeb-3.2.0 → QWeb-3.2.1}/setup.py +1 -1
  12. {QWeb-3.2.0 → QWeb-3.2.1}/LICENSE +0 -0
  13. {QWeb-3.2.0 → QWeb-3.2.1}/MANIFEST.in +0 -0
  14. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/__init__.py +0 -0
  15. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/__main__.py +0 -0
  16. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/custom_config.py +0 -0
  17. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/__init__.py +0 -0
  18. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/ajax.py +0 -0
  19. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/alert.py +0 -0
  20. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/blocks.py +0 -0
  21. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/__init__.py +0 -0
  22. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/android.py +0 -0
  23. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/bs_desktop.py +0 -0
  24. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/bs_mobile.py +0 -0
  25. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/chrome.py +0 -0
  26. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/edge.py +0 -0
  27. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/firefox.py +0 -0
  28. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/browser/safari.py +0 -0
  29. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/checkbox.py +0 -0
  30. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/config.py +0 -0
  31. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/config_defaults.py +0 -0
  32. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/cookies.py +0 -0
  33. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/decorators.py +0 -0
  34. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/download.py +0 -0
  35. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/dragdrop.py +0 -0
  36. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/dropdown.py +0 -0
  37. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/element.py +0 -0
  38. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/exceptions.py +0 -0
  39. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/file.py +0 -0
  40. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/frame.py +0 -0
  41. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/frame_checker.py +0 -0
  42. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/icon.py +0 -0
  43. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/input_.py +0 -0
  44. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/javascript.py +0 -0
  45. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/lists.py +0 -0
  46. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/meas.py +0 -0
  47. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/platform.py +0 -0
  48. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/screenshot.py +0 -0
  49. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/search_strategy.py +0 -0
  50. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/secrets.py +0 -0
  51. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/table.py +0 -0
  52. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/user.py +0 -0
  53. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/window.py +0 -0
  54. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/internal/xhr.py +0 -0
  55. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/__init__.py +0 -0
  56. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/ajax.py +0 -0
  57. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/alert.py +0 -0
  58. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/browser.py +0 -0
  59. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/checkbox.py +0 -0
  60. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/config.py +0 -0
  61. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/cookies.py +0 -0
  62. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/debug.py +0 -0
  63. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/download.py +0 -0
  64. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/dragdrop.py +0 -0
  65. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/dropdown.py +0 -0
  66. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/element.py +0 -0
  67. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/file.py +0 -0
  68. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/frame.py +0 -0
  69. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/icon.py +0 -0
  70. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/input_.py +0 -0
  71. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/javascript.py +0 -0
  72. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/lists.py +0 -0
  73. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/screenshot.py +0 -0
  74. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/search_strategy.py +0 -0
  75. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/table.py +0 -0
  76. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb/keywords/window.py +0 -0
  77. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/SOURCES.txt +0 -0
  78. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/dependency_links.txt +0 -0
  79. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/not-zip-safe +0 -0
  80. {QWeb-3.2.0 → QWeb-3.2.1}/QWeb.egg-info/top_level.txt +0 -0
  81. {QWeb-3.2.0 → QWeb-3.2.1}/README.md +0 -0
  82. {QWeb-3.2.0 → QWeb-3.2.1}/setup.cfg +0 -0
  83. {QWeb-3.2.0 → QWeb-3.2.1}/versioneer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QWeb
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Keyword driven automation for the web
5
5
  Home-page: https://github.com/qentinelqi/qweb/
6
6
  Author: Qentinel Group
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2024-03-08T14:03:57+0200",
11
+ "date": "2024-04-08T09:18:30+0300",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "a1077ceb7dc7393d4a0a502db68bae57f5983409",
15
- "version": "v3.2.0"
14
+ "full-revisionid": "8340ddbaf3eff96259c8c3b07467fdba9a27e331",
15
+ "version": "v3.2.1"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -388,7 +388,13 @@ def text_appearance(text: str, **kwargs: Any) -> bool:
388
388
 
389
389
  @decorators.timeout_decorator_for_actions
390
390
  def get_element_text(web_element: WebElement, expected=None, timeout: int = 0) -> Union[bool, str]: # pylint: disable=unused-argument
391
- real_text = web_element.text.strip()
391
+ # if both text and innerText are missing, innerText would return None instead of ""
392
+ # This needs to be handled here.
393
+ real_text = (
394
+ (web_element.text or "").strip()
395
+ or (web_element.get_attribute('innerText') or "").strip()
396
+ )
397
+
392
398
  if expected is not None:
393
399
  try:
394
400
  return _compare_texts(real_text, expected.strip(), timeout)
@@ -70,7 +70,7 @@ class InputHandler:
70
70
  else:
71
71
  javascript.execute_javascript("arguments[0].value = \"\"", input_element)
72
72
  else:
73
- input_element.send_keys(clear_key)
73
+ input_element.send_keys(*[key for key in clear_key if key is not None])
74
74
  try:
75
75
  write(input_element, input_text)
76
76
  # workaround for Firefox shadow dom inputs not always being reachable
@@ -280,7 +280,7 @@ def get_element_using_anchor(elements: list[WebElement], anchor: Optional[Union[
280
280
  len(elements), anchor_int + 1))
281
281
  if isinstance(anchor, str): # Get closest element to anchor
282
282
  kwargs['stay_in_current_frame'] = True
283
- anchor_element: WebElement
283
+ anchor_element: Optional[WebElement]
284
284
  if CONFIG['MultipleAnchors']:
285
285
  anchor_elements: list[WebElement] = []
286
286
  logger.debug('Multiple anchors enabled, trying to find first exact match')
@@ -291,14 +291,24 @@ def get_element_using_anchor(elements: list[WebElement], anchor: Optional[Union[
291
291
  logger.debug('Got no such frame from get exact text')
292
292
  if len(anchor_elements) > 0:
293
293
  # Using first exact match as anchor
294
- anchor_element = anchor_elements[0]
294
+
295
+ # We need to return the element that has the text, not parent
296
+ anchor_element = _get_anchor_with_inner_text(anchor_elements,
297
+ anchor,
298
+ exact_match=True)
299
+ anchor_element = anchor_element or anchor_elements[0]
295
300
  else:
296
301
  # No exact matches found, trying to find partial
297
302
  anchor_elements = get_text_elements( # type: ignore[assignment]
298
303
  anchor, **kwargs)
299
304
  if len(anchor_elements) > 0:
300
305
  logger.debug('No exact match found, using first partial match')
301
- anchor_element = anchor_elements[0]
306
+ # We need to return the element that includes the text, not parent
307
+ anchor_element = _get_anchor_with_inner_text(anchor_elements,
308
+ anchor,
309
+ exact_match=False)
310
+
311
+ anchor_element = anchor_element or anchor_elements[0]
302
312
  else:
303
313
  raise QWebElementNotFoundError(f"Could not find elements for anchor: {anchor}")
304
314
  else:
@@ -363,6 +373,29 @@ def _get_item_by_css(text: str, **kwargs) -> Optional[list[WebElement]]:
363
373
  return None
364
374
 
365
375
 
376
+ def _get_anchor_with_inner_text(anchor_elements: list[WebElement],
377
+ anchor: str,
378
+ exact_match: bool = True) -> Optional[WebElement]:
379
+ """
380
+ Finds the appropriate anchor element containing the given text in innertext based on
381
+ whether we are searching for an exact match or partial match.
382
+
383
+ Parameters:
384
+ - anchor_elements: List[WebElement], a list of WebElement objects to search through.
385
+ - anchor: str, the text to match against the element's innerText.
386
+ - exact_match: bool, specifies whether to look for an exact match or partial match.
387
+
388
+ Returns:
389
+ - Optional[WebElement]
390
+ """
391
+
392
+ for el in anchor_elements:
393
+ inner_text = el.get_attribute("innerText") or ""
394
+ if (exact_match and anchor == inner_text) or (not exact_match and anchor in inner_text):
395
+ return el
396
+ return None
397
+
398
+
366
399
  @frame.all_frames
367
400
  def get_clickable_element_by_js(locator: str,
368
401
  shadow_dom: bool = False,
@@ -23,7 +23,7 @@ from QWeb.internal.input_handler import INPUT_HANDLER as input_handler
23
23
  from QWeb.internal.exceptions import QWebValueMismatchError, QWebUnexpectedConditionError
24
24
  from robot.api import logger
25
25
  from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
26
- from selenium.common.exceptions import StaleElementReferenceException
26
+ from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException
27
27
  from selenium.webdriver.remote.webelement import WebElement
28
28
  import json
29
29
  import platform
@@ -376,6 +376,6 @@ def remove_stale_elements(elems: Optional[List[WebElement]]) -> Optional[List[We
376
376
  for elem in reversed(elems):
377
377
  try:
378
378
  elem.text
379
- except StaleElementReferenceException:
379
+ except (StaleElementReferenceException, NoSuchElementException):
380
380
  elems.remove(elem)
381
381
  return elems
@@ -88,7 +88,10 @@ def run_block(block: str, *args, timeout: Union[int, float, str] = 0, **kwargs)
88
88
  \`Appstate\`, \`SetConfig\`
89
89
  """
90
90
  step = [{'paceword': block, 'args': args, 'kwargs': {}}]
91
- _execute_block(step, timeout=timeout, **kwargs)
91
+ try:
92
+ _execute_block(step, timeout=timeout, **kwargs)
93
+ except QWebElementNotFoundError as e:
94
+ raise QWebUnexpectedConditionError(f"Runblock did not succeed in {timeout} seconds") from e
92
95
 
93
96
 
94
97
  @keyword(tags=("Config", "Error handling"))
@@ -149,6 +152,7 @@ def _execute_block(steps: list[dict[str, Any]], timeout: Union[int, float, str]
149
152
  teardown = kwargs.get('exp_handler', None)
150
153
  if teardown:
151
154
  BuiltIn().run_keyword_and_ignore_error(teardown)
155
+
152
156
  raise QWebElementNotFoundError(f'Err from block {res}')
153
157
  if var_name:
154
158
  BuiltIn().set_suite_variable(f'{var_name}', res)
@@ -862,23 +862,30 @@ def get_text(
862
862
  \`Is Text\`, \`VerifyText\`
863
863
  """
864
864
  anchor_int = util.anchor_to_index(anchor)
865
- tag = kwargs.get('tag', None)
865
+ tag = kwargs.pop('tag', None)
866
866
  if tag:
867
867
  try:
868
868
  kwargs['element_kw'] = True
869
869
  shadow_dom = CONFIG['ShadowDOM']
870
870
  if shadow_dom:
871
- web_element = internal_text.get_items_including_shadow_dom(locator, tag)[anchor_int]
871
+ web_element = internal_text.get_items_including_shadow_dom(locator,
872
+ tag,
873
+ **kwargs)[anchor_int]
872
874
  else:
873
875
  web_element = element.get_elements_by_attributes(tag, locator, **kwargs)[anchor_int]
874
876
  except ValueError as e:
875
877
  raise QWebValueError(
876
878
  'Only index is allowed anchor when searching element by it\'s attribute') from e
877
879
  elif '//' not in locator:
878
- web_element = internal_text.get_text_using_anchor(locator, anchor)
880
+ # css=False means we include non-clickable texts
881
+ web_element = internal_text.get_text_using_anchor(locator, anchor, css=False, **kwargs)
879
882
  else:
880
883
  web_element = element.get_unique_element_by_xpath(locator, index=anchor_int, **kwargs)
881
- text = web_element.text
884
+ # selenium's .text does not see all texts directly under slots
885
+ # use innerText as a backup
886
+ # note that "" at the end is important so that we don't get None instead of empty string
887
+ # if there is no text.
888
+ text = web_element.text or web_element.get_attribute('innerText') or ""
882
889
  if CONFIG['SearchMode']:
883
890
  element.draw_borders(web_element)
884
891
  return util.get_substring(text, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: QWeb
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Keyword driven automation for the web
5
5
  Home-page: https://github.com/qentinelqi/qweb/
6
6
  Author: Qentinel Group
@@ -6,7 +6,7 @@ requests>=2.31.0
6
6
  robotframework<8,>=4.1.3
7
7
  robotframework-debuglibrary==2.3.0
8
8
  selenium<5,>=4.10.0
9
- Pillow<11,>=10.0.2
9
+ Pillow<11,>=10.3.0
10
10
  scipy>=1.7.3
11
11
  scikit-image==0.21
12
12
  ply
@@ -52,7 +52,7 @@ setup(
52
52
  "robotframework>=4.1.3,<8",
53
53
  "robotframework-debuglibrary==2.3.0",
54
54
  "selenium>=4.10.0,<5",
55
- "Pillow>=10.0.2,<11",
55
+ "Pillow>=10.3.0,<11",
56
56
  "scipy>=1.7.3",
57
57
  "scikit-image==0.21",
58
58
  "ply",
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
File without changes
File without changes
File without changes