#!/usr/bin/env python # -*- coding: utf-8 -*- ''' @File : head_page_locator.py @Time : 2024/11/07 15:19:52 @Author : dulip3ng @Version : 1.0 @Desc : None ''' class HeadPageLocator: #按钮等相关定位 BUTTON_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '-BILLMENU_TOOLBAR')]/ul/li[contains(@class, 'k-item k-state-default kdmenuitem') and not(contains(@class, 'kd-menubtn-disabled'))]/span/span[text()='%s']" BUTTON_ARROW_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '-BILLMENU_TOOLBAR')]/ul/li[contains(@class, 'k-item k-state-default kdmenuitem') and not(contains(@class, 'kd-menubtn-disabled'))]/span/span[text()='%s']/following-sibling::span" SUB_BUTTON_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '-BILLMENU_TOOLBAR')]/ul/li[contains(@class, 'k-item k-state-default kdmenuitem') and not(contains(@class, 'kd-menubtn-disabled'))]//span[text()='%s']" SHEET_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//ul[@class = 'k-tabstrip-items k-reset']/descendant::span[text()='%s']" #字段赋值相关定位 TEXT_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::input[1]" BASE_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::input[1]" BASE_FIELD_SPAN_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::input/following-sibling::span" BASE_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]//table[@class = 'k-selectable']/descendant::td[text() = '%s']" SELECT_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]//span[@class = 'k-select']" SELECT_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/div/div[2]/ul/li[text() = '%s']" #获取字段值相关定位 TEXT_VALUE_INPUT_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[@role='kdspanlabel' and @title = '%s']/parent::div/following-sibling::div[contains(@class, 'kdItemContainer_editorct')]//input" TEXT_VALUE_SPAN_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[@role='kdspanlabel' and @title = '%s']/parent::div/following-sibling::div[1]/descendant::span[@class = 'ui-poplistedit-displayname']" SELECT_VALUE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[@role='kdspanlabel' and @title = '%s']/parent::div/following-sibling::div[contains(@class, 'kdItemContainer_editorct')]//*[@class='k-input']" BASE_VALUE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::span[@class='ui-poplistedit-displayname']" #字段类型解析相关定位 IS_SELECT_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]//span[@class = 'k-icon k-i-arrow-s']" IS_BASE_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]//span[@class = 'k-icon k-i-search']" PARSE_FIELD_TYPE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[@role='kdspanlabel' and translate(@title, ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[contains(@class, 'kdItemContainer_editorct')]/div" #审核印章 CHECKED_IMAGE_LOC = "//img[@src = '.././images/biz/default/Common/WaterMarks/approved_2052.png' and contains(@style, 'display: block')]" CHECKBOX_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//label[text()='%s']/../input[@class='k-checkbox']/../.."; TEXTAREA_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[text() = '%s']/parent::div/following-sibling::div[@class='kdItemContainer_editorct']/descendant::textarea"; MULTISELECT_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::span[text()='select']"; MULTISELECT_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/descendant::button[text() = '%s']"; MULTISELECT_OK_BTN_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/descendant::div[text() = '确定']"; TRIGGER_IN_HEAD_BODY_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//div[@class='k-grid-content k-auto-scrollable']/descendant::tr/td//*[@data-field = //th[@data-title='%s']/@data-field and @data-rowid = '%d']"; TEXT_FIELD_IN_HEAD_BODY_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//div[@class='k-grid-content k-auto-scrollable']/descendant::tr/td//*[@data-field = //th[@data-title='%s']/@data-field and @data-rowid = '%d']/ancestor::td/descendant::input"; BASE_FIELD_IN_HEAD_BODY_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//div[@class='k-grid-content k-auto-scrollable']/descendant::tr/td//*[@data-field = //th[@data-title='%s']/@data-field and @data-rowid = '%d']/ancestor::td/descendant::input"; MULTISELECT_VALUE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='first']//div[contains(@id, 'TAB') and @class = 'k-content k-state-active']//span[translate(text(), ' ', '') = translate('%s', ' ', '')]/parent::div/following-sibling::div[1]/descendant::span[contains(@class, 'ui-poplistedit-displayname')]"