ITK-dev-shared-components 2.17.2__tar.gz → 2.17.4__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 (54) hide show
  1. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/PKG-INFO +1 -1
  2. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/boliglaan/login.py +2 -2
  3. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/boliglaan/search/search_advis.py +23 -15
  4. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/eflyt_case.py +36 -17
  5. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components.egg-info/PKG-INFO +1 -1
  6. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/pyproject.toml +1 -1
  7. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/LICENSE +0 -0
  8. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/README.md +0 -0
  9. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/__init__.py +0 -0
  10. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/boliglaan/__init__.py +0 -0
  11. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/boliglaan/common.py +0 -0
  12. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/boliglaan/search/__init__.py +0 -0
  13. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/__init__.py +0 -0
  14. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/eflyt_letter.py +0 -0
  15. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/eflyt_login.py +0 -0
  16. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/eflyt_search.py +0 -0
  17. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/eflyt/eflyt_util.py +0 -0
  18. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/getorganized/__init__.py +0 -0
  19. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/getorganized/go_api.py +0 -0
  20. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/__init__.py +0 -0
  21. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/authentication.py +0 -0
  22. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/common.py +0 -0
  23. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/file.py +0 -0
  24. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/mail.py +0 -0
  25. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/graph/site.py +0 -0
  26. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/__init__.py +0 -0
  27. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/authentication.py +0 -0
  28. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/cpr.py +0 -0
  29. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/nova_cases.py +0 -0
  30. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/nova_documents.py +0 -0
  31. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/nova_notes.py +0 -0
  32. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/nova_objects.py +0 -0
  33. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/nova_tasks.py +0 -0
  34. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/kmd_nova/util.py +0 -0
  35. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/misc/__init__.py +0 -0
  36. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/misc/address_lookup.py +0 -0
  37. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/misc/cpr_util.py +0 -0
  38. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/misc/cvr_lookup.py +0 -0
  39. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/misc/file_util.py +0 -0
  40. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/__init__.py +0 -0
  41. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/fmcacov.py +0 -0
  42. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/gridview_util.py +0 -0
  43. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/multi_session.py +0 -0
  44. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/opret_kundekontakt.py +0 -0
  45. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/sap_login.py +0 -0
  46. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/sap_util.py +0 -0
  47. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/sap/tree_util.py +0 -0
  48. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/smtp/__init__.py +0 -0
  49. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components/smtp/smtp_util.py +0 -0
  50. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components.egg-info/SOURCES.txt +0 -0
  51. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components.egg-info/dependency_links.txt +0 -0
  52. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components.egg-info/requires.txt +0 -0
  53. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/itk_dev_shared_components.egg-info/top_level.txt +0 -0
  54. {itk_dev_shared_components-2.17.2 → itk_dev_shared_components-2.17.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itk_dev_shared_components
3
- Version: 2.17.2
3
+ Version: 2.17.4
4
4
  Summary: Shared components to use in RPA projects
5
5
  Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
6
6
  Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
@@ -27,8 +27,8 @@ def login(username: str, password: str):
27
27
  kmd_logon.ButtonControl(AutomationId="UserPwLogonButton").GetInvokePattern().Invoke()
28
28
 
29
29
  boliglaan = uiautomation.WindowControl(Name="KMD Boliglån", searchDepth=1)
30
- if not boliglaan.Exists(maxSearchSeconds=30):
31
- raise RuntimeError("Boliglån didn't appear within 30 seconds")
30
+ if not boliglaan.Exists(maxSearchSeconds=60):
31
+ raise RuntimeError("Boliglån didn't appear within 60 seconds")
32
32
 
33
33
 
34
34
  def kill_boliglaan():
@@ -4,7 +4,7 @@ and handling the advis search results.
4
4
 
5
5
  from dataclasses import dataclass
6
6
  from datetime import date
7
- from typing import Literal
7
+ from typing import Any, Literal
8
8
 
9
9
  import uiautomation
10
10
 
@@ -70,20 +70,21 @@ def search_advis(cpr: str | None = None, date_from: date | None = None, date_to:
70
70
  for type_ in types:
71
71
  popup.CheckBoxControl(Name=type_).GetTogglePattern().SetToggleState(1, waitTime=0)
72
72
 
73
- popup.ButtonControl(Name="Søg").GetInvokePattern().Invoke()
73
+ popup.ButtonControl(Name="Søg").Click(simulateMove=False)
74
74
 
75
75
 
76
76
  def select_advis(cpr: str, case_number: str):
77
77
  """Select the advis from the search list with the given cpr and case number."""
78
78
  boliglaan = common.get_boliglaan()
79
- rows = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").PaneControl(AutomationId="dataPresenter").GetChildren()
79
+ grid = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").DataGridControl(AutomationId="AdvisGridControl")
80
+ grid_pattern = grid.GetGridPattern()
80
81
 
81
- for row in rows:
82
- row_case_number = row.CustomControl(foundIndex=2).GetPattern(uiautomation.PatternId.ValuePattern).Value
83
- case_cpr = row.CustomControl(foundIndex=3).GetPattern(uiautomation.PatternId.ValuePattern).Value
82
+ for row in range(grid_pattern.RowCount):
83
+ row_case_number = _get_grid_value(grid_pattern, row, 1)
84
+ case_cpr = _get_grid_value(grid_pattern, row, 2)
84
85
 
85
86
  if case_cpr == cpr and row_case_number == case_number:
86
- row.DoubleClick(simulateMove=False)
87
+ grid_pattern.GetItem(row, 0).DoubleClick(simulateMove=False)
87
88
  return
88
89
 
89
90
  raise LookupError(f"Couldn't find advis: {cpr} - {case_number}")
@@ -92,17 +93,19 @@ def select_advis(cpr: str, case_number: str):
92
93
  def get_advis_list() -> list[Advis]:
93
94
  """Get the advis search result as a list of Advis objects."""
94
95
  boliglaan = common.get_boliglaan()
95
- rows = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").PaneControl(AutomationId="dataPresenter").GetChildren()
96
+
97
+ grid = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").DataGridControl(AutomationId="AdvisGridControl")
98
+ grid_pattern = grid.GetGridPattern()
96
99
 
97
100
  result = []
98
101
 
99
- for row in rows:
100
- date_str: str = row.CustomControl(foundIndex=1).GetPattern(uiautomation.PatternId.ValuePattern).Value
101
- case_number = row.CustomControl(foundIndex=2).GetPattern(uiautomation.PatternId.ValuePattern).Value
102
- cpr = row.CustomControl(foundIndex=3).GetPattern(uiautomation.PatternId.ValuePattern).Value
103
- type_ = row.CustomControl(foundIndex=4).GetPattern(uiautomation.PatternId.ValuePattern).Value
104
- state = row.CustomControl(foundIndex=5).GetPattern(uiautomation.PatternId.ValuePattern).Value
105
- case_type = row.CustomControl(foundIndex=7).GetPattern(uiautomation.PatternId.ValuePattern).Value
102
+ for row in range(grid_pattern.RowCount):
103
+ date_str: str = _get_grid_value(grid_pattern, row, 0)
104
+ case_number = _get_grid_value(grid_pattern, row, 1)
105
+ cpr = _get_grid_value(grid_pattern, row, 2)
106
+ type_ = _get_grid_value(grid_pattern, row, 3)
107
+ state = _get_grid_value(grid_pattern, row, 4)
108
+ case_type = _get_grid_value(grid_pattern, row, 6)
106
109
 
107
110
  day, month, year = (int(part) for part in date_str.split("-"))
108
111
  date_ = date(year, month, day)
@@ -110,3 +113,8 @@ def get_advis_list() -> list[Advis]:
110
113
  result.append(Advis(date=date_, cpr=cpr, case_number=case_number, type=type_, state=state, case_type=case_type))
111
114
 
112
115
  return result
116
+
117
+
118
+ def _get_grid_value(grid_pattern: uiautomation.GridPattern, row: int, column: int) -> Any:
119
+ """Helper function to get the value of a grid item."""
120
+ return grid_pattern.GetItem(row, column).GetPattern(uiautomation.PatternId.ValuePattern).Value
@@ -5,6 +5,11 @@ from datetime import date, datetime
5
5
  from selenium import webdriver
6
6
  from selenium.webdriver.common.by import By
7
7
  from selenium.webdriver.common.keys import Keys
8
+ from selenium.webdriver.support.ui import WebDriverWait
9
+ from selenium.webdriver.support import expected_conditions as EC
10
+ from selenium.common.exceptions import TimeoutException
11
+
12
+ WAIT_TIMEOUT = 10 # Seconds to wait for ASP.NET postbacks in approve_case.
8
13
 
9
14
 
10
15
  @dataclass
@@ -131,23 +136,34 @@ def change_tab(browser: webdriver.Chrome, tab_index: int):
131
136
 
132
137
 
133
138
  def approve_case(browser: webdriver.Chrome):
134
- """Approve a case.
135
- If any person on the case is blocking approval, approve each person individually.
139
+ """Approve a case, including cases where the anmeldelse is already approved and only the
140
+ persons remain. Uses waits around the ASP.NET postbacks to avoid stale/not-interactable
141
+ races. If any person on the case is blocking approval, approve each person individually.
136
142
  """
137
143
  change_tab(browser, 0)
138
144
 
139
- deadline_field = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_ncPersonTab_txtDeadline")
140
- deadline_field.clear()
141
- note_field = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_ncPersonTab_txtDeadlineNote")
142
- note_field.clear()
143
-
144
- browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkend").click()
145
- browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes").click()
146
-
147
- approve_persons_button = browser.find_elements(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkendAlle")
148
- if any(approve_persons_button) and approve_persons_button[0].is_enabled():
149
- approve_persons_button[0].click()
150
- else:
145
+ browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_ncPersonTab_txtDeadline").clear()
146
+ browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_ncPersonTab_txtDeadlineNote").clear()
147
+
148
+ # 1. Approve the anmeldelse only if that step is available (skip if already approved).
149
+ godkend = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkend")
150
+ if godkend.is_enabled():
151
+ godkend.click()
152
+ # 2. Confirm OK only if the confirmation dialog actually appears.
153
+ try:
154
+ WebDriverWait(browser, WAIT_TIMEOUT).until(
155
+ EC.element_to_be_clickable((By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes"))
156
+ ).click()
157
+ except TimeoutException:
158
+ pass
159
+
160
+ # 3. Approve the persons; clickability decides bulk vs per-person and waits out the
161
+ # postback (no is_enabled() on a stale element).
162
+ try:
163
+ WebDriverWait(browser, WAIT_TIMEOUT).until(
164
+ EC.element_to_be_clickable((By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkendAlle"))
165
+ ).click()
166
+ except TimeoutException:
151
167
  # Approve each person individually
152
168
  person_count = len(browser.find_elements(By.XPATH, '//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr')) - 1
153
169
 
@@ -155,9 +171,12 @@ def approve_case(browser: webdriver.Chrome):
155
171
  browser.find_element(By.XPATH, f'//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr[{i+2}]//td[2]').click()
156
172
 
157
173
  browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnGodkend").click()
158
- approve_button = browser.find_element(By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes")
159
- if approve_button.is_displayed():
160
- approve_button.click()
174
+ try:
175
+ WebDriverWait(browser, WAIT_TIMEOUT).until(
176
+ EC.element_to_be_clickable((By.ID, "ctl00_ContentPlaceHolder2_ptFanePerson_stcPersonTab1_btnApproveYes"))
177
+ ).click()
178
+ except TimeoutException:
179
+ pass
161
180
 
162
181
  # Go back to the case
163
182
  browser.find_element(By.XPATH, '//table[@id="ctl00_ContentPlaceHolder2_GridViewMovingPersons"]//tr[1]//td[2]').click()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: itk_dev_shared_components
3
- Version: 2.17.2
3
+ Version: 2.17.4
4
4
  Summary: Shared components to use in RPA projects
5
5
  Author-email: ITK Development <itk-rpa@mkb.aarhus.dk>
6
6
  Project-URL: Homepage, https://github.com/itk-dev-rpa/itk-dev-shared-components
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "itk_dev_shared_components"
7
- version = "2.17.2"
7
+ version = "2.17.4"
8
8
  authors = [
9
9
  { name="ITK Development", email="itk-rpa@mkb.aarhus.dk" },
10
10
  ]