From 806156c6c6922f48cdcf33edc160046ceff091c4 Mon Sep 17 00:00:00 2001 From: mardausdennis <71312763+mardausdennis@users.noreply.github.com> Date: Sat, 29 Aug 2026 18:46:47 +0200 Subject: [PATCH] do not click a different streak when the daily set label is missing The positional fallback returned whatever sat at index 3 of the streaks section. On a partially rendered page that is not the daily set: observed live returning 'Mobile App | Check-in: 0/1', and clicking it opens the app store page instead of the panel, which is what #45 and #46 describe. It now checks the label before handing the button back and raises otherwise, so the task is skipped rather than the wrong streak clicked. --- src/element_selectors.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/element_selectors.py b/src/element_selectors.py index 6708372..24d3381 100644 --- a/src/element_selectors.py +++ b/src/element_selectors.py @@ -154,7 +154,24 @@ class ElementSelectionUtils: try: return self._button_containing(Labels.DAILY_SET_STREAK) except NoSuchElementException: - return self._streaks_button(3) + pass + + # The positional fallback only helps if what sits there really is the + # daily set entry. On a partially rendered streaks section it is not: + # observed returning the mobile app entry, and clicking that opens the + # app store page instead of the panel, which is what the reports in #45 + # and #46 describe. Check before handing it back, and skip the task + # rather than click the wrong streak. + candidate = self._streaks_button(3) + label = (candidate.text or "").strip() + + if "daily set" not in label.lower(): + raise NoSuchElementException( + "daily set opener not found by label, and position 3 holds " + f"{label.splitlines()[0] if label else ''!r} instead" + ) + + return candidate def get_daily_set_elements(self): """The daily set activities in the opened panel.