From 588541c69b8be61837ed87aa7e656e3d7124e94c Mon Sep 17 00:00:00 2001 From: Mathias G Date: Wed, 8 Jul 2026 10:05:14 +0200 Subject: [PATCH 1/4] Upped timeout for login to 60 seconds --- itk_dev_shared_components/boliglaan/login.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itk_dev_shared_components/boliglaan/login.py b/itk_dev_shared_components/boliglaan/login.py index 8eb475b..2937e1c 100644 --- a/itk_dev_shared_components/boliglaan/login.py +++ b/itk_dev_shared_components/boliglaan/login.py @@ -27,8 +27,8 @@ def login(username: str, password: str): kmd_logon.ButtonControl(AutomationId="UserPwLogonButton").GetInvokePattern().Invoke() boliglaan = uiautomation.WindowControl(Name="KMD Boliglån", searchDepth=1) - if not boliglaan.Exists(maxSearchSeconds=30): - raise RuntimeError("Boliglån didn't appear within 30 seconds") + if not boliglaan.Exists(maxSearchSeconds=60): + raise RuntimeError("Boliglån didn't appear within 60 seconds") def kill_boliglaan(): From 268b741ba8227431172e50ff7d6557a64fc97b6b Mon Sep 17 00:00:00 2001 From: Mathias G Date: Wed, 8 Jul 2026 10:32:40 +0200 Subject: [PATCH 2/4] Greatly improved advis list interaction --- .../boliglaan/search/search_advis.py | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/itk_dev_shared_components/boliglaan/search/search_advis.py b/itk_dev_shared_components/boliglaan/search/search_advis.py index 3afc000..1fd3428 100644 --- a/itk_dev_shared_components/boliglaan/search/search_advis.py +++ b/itk_dev_shared_components/boliglaan/search/search_advis.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from datetime import date -from typing import Literal +from typing import Any, Literal import uiautomation @@ -70,20 +70,21 @@ def search_advis(cpr: str | None = None, date_from: date | None = None, date_to: for type_ in types: popup.CheckBoxControl(Name=type_).GetTogglePattern().SetToggleState(1, waitTime=0) - popup.ButtonControl(Name="Søg").GetInvokePattern().Invoke() + popup.ButtonControl(Name="Søg").Click(simulateMove=False) def select_advis(cpr: str, case_number: str): """Select the advis from the search list with the given cpr and case number.""" boliglaan = common.get_boliglaan() - rows = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").PaneControl(AutomationId="dataPresenter").GetChildren() + grid = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").DataGridControl(AutomationId="AdvisGridControl") + grid_pattern = grid.GetGridPattern() - for row in rows: - row_case_number = row.CustomControl(foundIndex=2).GetPattern(uiautomation.PatternId.ValuePattern).Value - case_cpr = row.CustomControl(foundIndex=3).GetPattern(uiautomation.PatternId.ValuePattern).Value + for row in range(grid_pattern.RowCount): + row_case_number = _get_grid_value(grid_pattern, row, 1) + case_cpr = _get_grid_value(grid_pattern, row, 2) if case_cpr == cpr and row_case_number == case_number: - row.DoubleClick(simulateMove=False) + grid_pattern.GetItem(row, 0).DoubleClick(simulateMove=False) return raise LookupError(f"Couldn't find advis: {cpr} - {case_number}") @@ -92,17 +93,19 @@ def select_advis(cpr: str, case_number: str): def get_advis_list() -> list[Advis]: """Get the advis search result as a list of Advis objects.""" boliglaan = common.get_boliglaan() - rows = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").PaneControl(AutomationId="dataPresenter").GetChildren() + + grid = boliglaan.TabControl(Name="TabbedGroup", searchDepth=4).GroupControl(Name="Advis").DataGridControl(AutomationId="AdvisGridControl") + grid_pattern = grid.GetGridPattern() result = [] - for row in rows: - date_str: str = row.CustomControl(foundIndex=1).GetPattern(uiautomation.PatternId.ValuePattern).Value - case_number = row.CustomControl(foundIndex=2).GetPattern(uiautomation.PatternId.ValuePattern).Value - cpr = row.CustomControl(foundIndex=3).GetPattern(uiautomation.PatternId.ValuePattern).Value - type_ = row.CustomControl(foundIndex=4).GetPattern(uiautomation.PatternId.ValuePattern).Value - state = row.CustomControl(foundIndex=5).GetPattern(uiautomation.PatternId.ValuePattern).Value - case_type = row.CustomControl(foundIndex=7).GetPattern(uiautomation.PatternId.ValuePattern).Value + for row in range(grid_pattern.RowCount): + date_str: str = _get_grid_value(grid_pattern, row, 0) + case_number = _get_grid_value(grid_pattern, row, 1) + cpr = _get_grid_value(grid_pattern, row, 2) + type_ = _get_grid_value(grid_pattern, row, 3) + state = _get_grid_value(grid_pattern, row, 4) + case_type = _get_grid_value(grid_pattern, row, 6) day, month, year = (int(part) for part in date_str.split("-")) date_ = date(year, month, day) @@ -110,3 +113,8 @@ def get_advis_list() -> list[Advis]: result.append(Advis(date=date_, cpr=cpr, case_number=case_number, type=type_, state=state, case_type=case_type)) return result + + +def _get_grid_value(grid_pattern: uiautomation.GridPattern, row: int, column: int) -> Any: + """Helper function to get the value of a grid item.""" + return grid_pattern.GetItem(row, column).GetPattern(uiautomation.PatternId.ValuePattern).Value From ad7452206d6291a6cf39c028844aff69b64f2679 Mon Sep 17 00:00:00 2001 From: Mathias G Date: Wed, 8 Jul 2026 10:34:31 +0200 Subject: [PATCH 3/4] Bumped version --- changelog.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index ff5ac1f..b471546 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.17.4] - 2026-07-08 + +### Fixed + +- Boliglån: Extended login timeout to 60 seconds. +- Boliglån: Greatly improved interaction with advis list. + ## [2.17.3] - 2026-07-06 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index b7f6aa7..d64aadd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "itk_dev_shared_components" -version = "2.17.3" +version = "2.17.4" authors = [ { name="ITK Development", email="itk-rpa@mkb.aarhus.dk" }, ] From 8ee670225deb863a76065fec261cf66ae7deeac8 Mon Sep 17 00:00:00 2001 From: Mathias G Date: Wed, 8 Jul 2026 10:37:22 +0200 Subject: [PATCH 4/4] Updated changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index b471546..bd9a586 100644 --- a/changelog.md +++ b/changelog.md @@ -309,6 +309,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release +[2.17.4]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.17.4 [2.17.3]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.17.3 [2.17.2]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.17.2 [2.17.1]: https://github.com/itk-dev-rpa/ITK-dev-shared-components/releases/tag/2.17.1