Skip to content

Commit

Permalink
Handle when cards go big mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cal4 committed Jul 6, 2024
1 parent a252a1c commit d6ba71c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/activities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import random
import time

from selenium.common import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement

from src.browser import Browser

Expand All @@ -21,10 +23,17 @@ def openDailySetActivity(self, cardId: int):

def openMorePromotionsActivity(self, cardId: int):
# Open the More Promotions activity for the given cardId
self.webdriver.find_element(
By.XPATH,
f'//*[@id="more-activities"]/div/mee-card[{cardId}]/div/card-content/mee-rewards-more-activities-card-item/div/a',
).click()
activity: WebElement
try:
activity = self.webdriver.find_element(
By.XPATH,
f'//*[@id="more-activities"]/div/mee-card[{cardId}]/div/card-content/mee-rewards-more-activities-card-item/div/a',
)
# Handle when card is big, appears to be random
except NoSuchElementException:
activity = self.webdriver.find_element(By.XPATH,
"//mee-card-group[@id=\'more-activities\']/div/mee-card/div/card-content/mee-rewards-more-activities-card-item/div/a")
activity.click()
self.browser.utils.switchToNewTab(timeToWait=8)

def completeSearch(self):
Expand Down

0 comments on commit d6ba71c

Please sign in to comment.