Skip to content

Commit

Permalink
Update activities.py
Browse files Browse the repository at this point in the history
Added:
     def click_element_if_visible(self, element):
        try:
            if element.is_displayed() and element.is_enabled():
                element.click()
                logging.info("Dashboard pop-up registered and closed, needs to be done once on new accounts")
            else:
                pass
        except (ElementNotInteractableException, NoSuchElementException):
            pass

    def dashboardPopUpModalCloseCross(self):
        try:

            element = self.webdriver.find_element(By.CSS_SELECTOR, ".dashboardPopUpPopUpSelectButton")
            self.click_element_if_visible(element)
            time.sleep(0.25)
        except NoSuchElementException:
            return


-goodluck
  • Loading branch information
Rippenkneifer authored Sep 6, 2024
1 parent 4400d48 commit 2b4ea72
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/activities.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import contextlib
import random
import time
import logging

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

from selenium.common.exceptions import NoSuchElementException, ElementNotInteractableException
from src.browser import Browser


Expand All @@ -14,6 +15,29 @@ def __init__(self, browser: Browser):
self.browser = browser
self.webdriver = browser.webdriver

def click_element_if_visible(self, element):
try:
if element.is_displayed() and element.is_enabled():
element.click()
logging.info("Dashboard pop-up registered and closed, needs to be done once on new accounts")
else:
pass
except (ElementNotInteractableException, NoSuchElementException):
pass

def dashboardPopUpModalCloseCross(self):
try:

element = self.webdriver.find_element(By.CSS_SELECTOR, ".dashboardPopUpPopUpSelectButton")
self.click_element_if_visible(element)
time.sleep(0.25)
except NoSuchElementException:
return





def openDailySetActivity(self, cardId: int):
# Open the Daily Set activity for the given cardId
element = self.webdriver.find_element(By.XPATH,
Expand Down

0 comments on commit 2b4ea72

Please sign in to comment.