Refactor tryDismissAllMessages
bug
Fix #289
This PR refactors `tryDismissAllMessages` to simplify it and ensure a proper error handling.
---
Creating this as a draft PR for now, as I need @cal4's opinion on something:
As shown in #289, the `dashboardPopUpPopUpSelectButton` button doesn't seem to be clickable anymore.
```
2025-05-02 21:54:07,717 [DEBUG] [DISMISS] Dismissing an element by clicking on <a class="dashboardPopUpPopUpSelectButton ng-binding" ng-click="$ctrl.hidePopUpAndApplyFunction($event)" data-bi-id="rx-nav-popup" target="_self" id="reward_pivot_earn">
</a>
Traceback (most recent call last):
File "c:\Tools\MS-Rewards-Farmer\klept0\fix-cookie-banner\src\activities.py", line 163, in completeActivity
self.browser.utils.click(activityElement)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "c:\Tools\MS-Rewards-Farmer\klept0\fix-cookie-banner\src\utils.py", line 414, in click
self.tryDismissAllMessages()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "c:\Tools\MS-Rewards-Farmer\klept0\fix-cookie-banner\src\utils.py", line 390, in tryDismissAllMessages
dismissButton.click()
~~~~~~~~~~~~~~~~~~~^^
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=136.0.7103.48)
```
Do you think I should just remove its detection or leave it as is (try to click on it and ignore its error)? I'm not sure if the fact that it's not interactable is exceptional or if it's always the case now.
合并状态:已合并 合并于 2025-05-05 关闭于 2025-05-05 2 条评论