mirror of
https://github.com/User0332/rewards-farmer.git
synced 2026-09-16 09:31:36 +00:00
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:
@@ -154,7 +154,24 @@ class ElementSelectionUtils:
|
|||||||
try:
|
try:
|
||||||
return self._button_containing(Labels.DAILY_SET_STREAK)
|
return self._button_containing(Labels.DAILY_SET_STREAK)
|
||||||
except NoSuchElementException:
|
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):
|
def get_daily_set_elements(self):
|
||||||
"""The daily set activities in the opened panel.
|
"""The daily set activities in the opened panel.
|
||||||
|
|||||||
Reference in New Issue
Block a user