def view_window(self, window_index=0): """ 视图操作窗口(语谱图+右侧列表栏:音素列表、标记列表...) :param window_index: 窗口序号,第一个语谱图为0,以此类推 :return: 视图操作窗口对象 """ value = "//div[contains(@class, 'spectrum-item')]" elements = api.find_elements(self.browser, 'xpath', value) return elements[window_index]
def phoneme_filter_button(parent) -> list: """ 定位音素过滤按钮 :param parent: 视图操作窗口 :return: 过滤按钮元素列表 """ value = ".//i[@class='spk-pc icon-icon_filt_normal-']" elements = api.find_elements(parent, 'xpath', value) return elements
def phoneme_tag_button(parent) -> list: """ 定位音素列表的【➕】添加按钮 :param parent: 视图操作窗口 :return: 标记按钮元素列表 """ value = ".//i[@class='spk-pc icon-tubiao_biaoji']" elements = api.find_elements(parent, 'xpath', value) return elements
def find_cases_in_list(self, keyword): """ 查找出案件列表所有案件 :return: 所有案件元素对象组成的列表 """ value = f"//div[@class='case_list']//div[@class='List']//" \ f"span[@class='normal_title' and contains(text(), '{keyword}')]" element = api.find_elements(self.browser, 'xpath', value) return element
def find_cases_in_recycle(self, keyword): """ 在案件回收站中查找所有案件 :param keyword: :return: """ value = f"//div[@class='case_list']//span[contains(text(), '{keyword}')]" elements = api.find_elements(self.browser, value=value) return elements
def add_file_button(parent, button_index=0): """ 【新建文件】按钮 :param parent: 视图操作窗口 :param button_index: 按钮序号(因为可能存在多个新建语谱图窗口) :return: 【新建文件】按钮元素对象 """ value = ".//a[text()='新建文件']" elements = api.find_elements(parent, 'xpath', value) return elements[button_index]
def append_record_button(parent, button_index: int): """ 图谱测量窗口的【添加记录】按钮 :param parent: 图谱测量窗口 :param button_index: 按钮序号 :return: 【添加记录】按钮元素对象 """ value = f".//div[@class='lpc-icon']//span[@title='添加记录']" elements = api.find_elements(parent, 'xpath', value) return elements[button_index]
def location_folder(self, folder_name): """目标对象的存储文件夹""" value = f"//div[contains(@class, 'ant-cascader-menus')]//ul/" \ f"li[not(contains(@class, 'active')) and text()='{folder_name}']" element = api.find_element(self.browser, value=value) if element.is_displayed() is False: value = f"//div[contains(@class, 'ant-cascader-menus')]//ul/" \ f"li[not(contains(@class, 'active')) and text()='{folder_name}']" element = api.find_elements(self.browser, value=value)[1] return element
def group_button(parent, group_name, button_index: int): """ 用户组操作按钮:0-编辑,1-删除 :param parent: :param group_name: :param button_index: :return: """ value = f"//span[text()='{group_name}']/following-sibling::span/i" elements = api.find_elements(parent, 'xpath', value) return elements[button_index]
def password_input(parent, input_box_index: int): value = "//input[@type='password']" elements = api.find_elements(parent, 'xpath', value) return elements[input_box_index]
def tag_check_box(parent): value = ".//input[@type='checkbox']" elements = api.find_elements(parent, 'xpath', value) return elements