Files
doczyai-pipelines/Doczy.AI_Automation/elements/interface_2_elements.py
T
Michael McGuinness 037909db74 format codebase
2024-09-30 12:21:29 +01:00

69 lines
2.6 KiB
Python

from selenium.webdriver.common.by import By
from utils.element_related_methods import (
get_clickable_element,
get_invisible_element,
get_element,
)
class Interface_2_elements:
client_name_dropdown_xpath = '//div[@data-testid="stSelectbox"]'
client_list_xpath = "//li"
batch_id_xpath = '(//div[@data-testid="stSelectbox"])[2]'
batch_id_list_xpath = "//li"
contract_name_xpath = '(//div[@data-testid="stSelectbox"])[3]'
contract_name_list_xpath = "//li"
field_group_xpath = '(//div[@data-testid="stSelectbox"])[4]'
field_group_list_xpath = "//li"
show_result_btn_xpath = "//button[.//p[text()='Show Results']]"
result_table_xpath = "//table[@aria-colcount='9']"
table_rows_xpath = ".//tbody/tr"
kickoff_database_btn_xpath = "//button[.//p[text()='Kickoff Database Integration']]"
error_xpath = "//div[@data-testid='stNotificationContentError']/div/div/p"
def get_client_name_dropdown(self, driver, config):
return get_clickable_element(
driver, config, By.XPATH, self.client_name_dropdown_xpath
)
def get_client_list(self, driver):
return driver.find_elements(By.XPATH, self.client_list_xpath)
def get_batch_id(self, driver, config):
return get_clickable_element(driver, config, By.XPATH, self.batch_id_xpath)
def get_batch_id_list(self, driver):
return driver.find_elements(By.XPATH, self.batch_id_list_xpath)
def get_contract_name(self, driver, config):
return get_clickable_element(driver, config, By.XPATH, self.contract_name_xpath)
def get_contract_name_list(self, driver):
return driver.find_elements(By.XPATH, self.contract_name_list_xpath)
def get_field_group(self, driver, config):
return get_clickable_element(driver, config, By.XPATH, self.field_group_xpath)
def get_field_group_list(self, driver):
return driver.find_elements(By.XPATH, self.field_group_list_xpath)
def get_show_result_btn(self, driver, config):
return get_clickable_element(
driver, config, By.XPATH, self.show_result_btn_xpath
)
def get_result_table(self, driver, config):
return get_element(driver, config, By.XPATH, self.result_table_xpath)
def get_table_rows(self, result_table):
return result_table.find_elements(By.XPATH, self.table_rows_xpath)
def get_kickoff_database_btn(self, driver, config):
return get_clickable_element(
driver, config, By.XPATH, self.kickoff_database_btn_xpath
)
def get_error_toast(self, driver, config):
return get_element(driver, config, By.XPATH, self.error_xpath)