from selenium.webdriver.common.by import By from utils.element_related_methods import ( get_clickable_element, get_invisible_element, get_element, ) class Interface_1_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" checkbox_list_xpath = "//div[@data-testid='stCheckbox']" read_the_contracts_from_path_btn_xpath = ( "//button[.//p[text()='Read the contracts from Path']]" ) result_table_xpath = "//table[@aria-colcount='9']" table_rows_xpath = ".//tbody/tr" run_doczy_ai_pipeline_btn_xpath = "//button[.//p[text()='Run Doczy.AI Pipeline']]" 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_checkbox_list(self, driver): return driver.find_elements(By.XPATH, self.checkbox_list_xpath) def get_read_the_contracts_from_path_btn(self, driver, config): return get_clickable_element( driver, config, By.XPATH, self.read_the_contracts_from_path_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_run_doczy_ai_pipeline_btn(self, driver, config): return get_clickable_element( driver, config, By.XPATH, self.run_doczy_ai_pipeline_btn_xpath ) def get_error(self, driver, config): return get_element(driver, config, By.XPATH, self.error_xpath)