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.
This commit is contained in:
mardausdennis
2026-08-29 18:46:47 +02:00
parent 238050ba9a
commit 806156c6c6
+18 -1
View File
@@ -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 '<empty>'!r} instead"
)
return candidate
def get_daily_set_elements(self):
"""The daily set activities in the opened panel.