Files
doczyai-pipelines/archive/Doczy.AI_Automation/elements/interface_0_elements.py
T

47 lines
1.6 KiB
Python
Raw Normal View History

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_0_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
file_input_xpath = "//input[@type='file']"
2024-09-30 12:21:29 +01:00
file_input_progress_xpath = (
'//div[@role="progressbar"]' #'//div[@class="stFileUploaderFileName"]'
)
create_batch_btn_xpath = (
"//div[@data-testid='stButton']/button[@data-testid='baseButton-secondary']"
)
2024-08-21 19:26:08 +05:30
p_element_xpath = "//div[@data-testid='stCodeBlock']/pre/div/code/span"
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_file_input(self, driver, config):
return get_invisible_element(driver, config, By.XPATH, self.file_input_xpath)
def get_file_input_progress(self, driver):
return driver.find_elements(By.XPATH, self.file_input_progress_xpath)
def get_create_batch_btn(self, driver, config):
2024-09-30 12:21:29 +01:00
return get_clickable_element(
driver, config, By.XPATH, self.create_batch_btn_xpath
)
2024-08-21 19:26:08 +05:30
def get_p_element(self, driver, config):
return get_element(driver, config, By.XPATH, self.p_element_xpath)
def get_error_toast(self, driver, config):
return get_element(driver, config, By.XPATH, self.error_xpath)