2024-08-21 19:26:08 +05:30
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
|
2024-09-30 12:21:29 +01:00
|
|
|
from utils.element_related_methods import (
|
|
|
|
|
get_clickable_element,
|
|
|
|
|
get_invisible_element,
|
|
|
|
|
get_element,
|
|
|
|
|
)
|
2024-08-21 19:26:08 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
class Interface_2_elements:
|
|
|
|
|
client_name_dropdown_xpath = '//div[@data-testid="stSelectbox"]'
|
2024-09-30 12:21:29 +01:00
|
|
|
client_list_xpath = "//li"
|
2024-08-21 19:26:08 +05:30
|
|
|
batch_id_xpath = '(//div[@data-testid="stSelectbox"])[2]'
|
2024-09-30 12:21:29 +01:00
|
|
|
batch_id_list_xpath = "//li"
|
2024-08-21 19:26:08 +05:30
|
|
|
contract_name_xpath = '(//div[@data-testid="stSelectbox"])[3]'
|
2024-09-30 12:21:29 +01:00
|
|
|
contract_name_list_xpath = "//li"
|
2024-08-21 19:26:08 +05:30
|
|
|
field_group_xpath = '(//div[@data-testid="stSelectbox"])[4]'
|
2024-09-30 12:21:29 +01:00
|
|
|
field_group_list_xpath = "//li"
|
2024-08-21 19:26:08 +05:30
|
|
|
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):
|
2024-09-30 12:21:29 +01:00
|
|
|
return get_clickable_element(
|
|
|
|
|
driver, config, By.XPATH, self.client_name_dropdown_xpath
|
|
|
|
|
)
|
2024-08-21 19:26:08 +05:30
|
|
|
|
|
|
|
|
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):
|
2024-09-30 12:21:29 +01:00
|
|
|
return get_clickable_element(
|
|
|
|
|
driver, config, By.XPATH, self.show_result_btn_xpath
|
|
|
|
|
)
|
2024-08-21 19:26:08 +05:30
|
|
|
|
|
|
|
|
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):
|
2024-09-30 12:21:29 +01:00
|
|
|
return get_clickable_element(
|
|
|
|
|
driver, config, By.XPATH, self.kickoff_database_btn_xpath
|
|
|
|
|
)
|
2024-08-21 19:26:08 +05:30
|
|
|
|
|
|
|
|
def get_error_toast(self, driver, config):
|
|
|
|
|
return get_element(driver, config, By.XPATH, self.error_xpath)
|