selenium_automation_project/page_objects/home_dashboard_page.py

35 lines
1.2 KiB
Python

from selenium.webdriver.common.by import By
from page_objects.base_page import BasePage
class HomeDashboardPage(BasePage):
"""
Page object for the main Home/Dashboard page, specifically handling the top navigation.
"""
# Locators
_PROFILE_TAB = (By.XPATH, "//button[@role='tab' and contains(@id,'trigger-profile')]")
_SETTINGS_TAB = (By.XPATH, "//button[@role='tab' and contains(@id,'trigger-settings')]")
DANGER_ZONE_LINK = (By.LINK_TEXT, "Danger Zone")
LOGOUT_BUTTON = (By.XPATH, "//button[text()='Logout']")
_DASHBORAD_TEST_CASES_TITLE = (By.XPATH,'//*[contains(@id,"content-dashboard")]/div/div[1]//h3')
def navigate_to_profile(self):
"""
Clicks the 'Profile' link to navigate to the Profile Editor page.
"""
self.click(self._PROFILE_TAB)
def navigate_to_settings(self):
"""
Clicks the 'Settings' link to navigate to the Settings Panel page.
"""
self.click(self._SETTINGS_TAB)
def verify_title_is_dashboarde(self):
return self.get_text(self._DASHBORAD_TEST_CASES_TITLE)
def logout(self):
"""
Clicks the 'Logout' button.
"""
self.click(self.LOGOUT_BUTTON)