import logging import time import allure from ui_automation_framework.core import BasePage, TestStatus from ui_automation_framework.utils import logger as cl class AppleCharts(BasePage): log = cl.Logger(logging.DEBUG) def __init__(self, driver): super().__init__(driver) self.driver = driver self.apple_charts_page = self.get_page_locators("AppleCharts", "third_party/applecharts_elements.json") self.ts = TestStatus(self.driver) @allure.step("Apple charts - get track name") def get_track_names(self): self.wait_for_element_visible(*self.locator(self.apple_charts_page, "track_names")) self.page_has_loaded() time.sleep(5) elements = self.get_elements(*self.locator(self.apple_charts_page, "track_names")) names = [self.get_text(element=e).strip() for e in elements] return names @allure.step("Apple charts - get artist name") def get_artist_names(self): self.wait_for_element_visible(*self.locator(self.apple_charts_page, "artist_names")) self.page_has_loaded() time.sleep(5) elements = self.get_elements(*self.locator(self.apple_charts_page, "artist_names")) names = [self.get_text(element=e).strip() for e in elements] return names @allure.step("Apple charts - open third party") def open(self, market, country, playlist_id): self.open_url("https://music.apple.com/{market}/playlist/top-100-{country}/{playlist_id}".format(market=market, country=country, playlist_id=playlist_id)) self.page_has_loaded()