Commit b63ef457 authored by libin's avatar libin
Browse files

20190820

parent f7d5631c
......@@ -80,6 +80,7 @@ class WebClient():
'''清除控件文本'''
def clear_elem_text(self, element_selector, find_by=By.XPATH):
self.get_element(element_selector, find_by).send_keys(chr(127)) #有些元素调用clear无效,127对应的是删除
self.get_element(element_selector, find_by).clear()
time.sleep(self.timeout)
......@@ -168,31 +169,9 @@ class WebClient():
element.click()
time.sleep(self.timeout)
# 多次点击控件,默认连续点击3次,默认控件在最最底端
def mutiple_click_element(self, element_selector, find_by=By.XPATH, times=3, if_scrool_to_bottom=1):
i= 1
while i < times:
if if_scrool_to_bottom == 1:
self.scroll_to_bottom()
try:
self.wait_unit_elem(element_selector, find_by)
except Exception:
break
element = self.get_element(element_selector, find_by)
element.click()
time.sleep(self.timeout)
i = i + 1
del i
# 到最后一页,element_selector取上一层,默认控件在最最底端
def to_last_page(self, element_selector, if_scrool_to_bottom=1):
selector = element_selector + "/li[last()-1]"
if if_scrool_to_bottom == 1:
self.scroll_to_bottom()
self.wait_unit_elem(selector, By.XPATH)
element = self.get_element(selector, By.XPATH)
element.click()
time.sleep(self.timeout)
#点击坐标,x,y为距离上一步的相对位置
def click_coordinate(self, x, y):
ActionChains(self.__driver).move_by_offset(x, y).click().perform()
# 按命令滚动浏览器滚动条,document.body.scrollTop
def scroll_to_command(self, command):
......
......@@ -53,7 +53,7 @@ PW_NOT_EQUAL_MSG = "两次输入新密码不一致"
CHANGE_PW_SUCCESS = "密码修改成功,请重新登录!"
NAVIGATION_MENU_TITLE = "智能工位管理系统"
WHOLE_TEXT = "全部"
ENTER_NAME_TEXT = "请输入姓名"
ENTER_NAME_TEXT = "请输入员工工号或姓名"
MAX_INPUT_ATTRIBUTE = "maxlength"
MAX_INPUT_CHARACTER_NUM = "50"
ATTRIBUTE_VALUE = 'value'
......
UPLOADING_STATION_MAP_BTN = ".//*[@class='ant-table-tbody']/tr[1]/td[11]/div/a[1]/i"
UPLOADING_STATION_MAP2_BTN = ".//*[@class='ant-table-tbody']/tr[2]/td[11]/div/a[1]/i"
EDIT_STATION_MAP_BTN = "icon-ditu_0"
UPLOADING_STATION_MAP_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[1]//a[1]/i"
UPLOADING_STATION_MAP2_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[2]//a[1]/i"
EDIT_STATION_MAP_BTN = "#main .ant-table-fixed-right tbody tr:first-child a:nth-child(2) i"
STATION_SEAT_MANAGEMENT_BTN = "icon-zuowei_0"
DRAW_PATH_BTN = ".//i[@class='iconfont icon-lujingfenxi']"
DYNAMIC_MSG = ".//*[@class='ant-message-notice-content']/div[1]/span[1]"
......@@ -25,7 +25,7 @@ AREA_OF_REGION_INPUT = "[name='areaAge'] input"
'''编辑工位地图页面'''
SINGLE_ROW_ICON = ".//div[@class='svg-ele']/*[name()='svg']/*[name()='g']/*[name()='rect']"
PIN_ICON = ".//*[@class='attr-svg']/div[2]/div[1]/*[name()='svg']/*[name()='g']"
PIN_ICON = ".//*[@class='attr-svg']/div[2]/div[2]/div"
STATION_TARGET_POSITION_X = 400
STATION_TARGET_POSITION_Y = 200
COPY_BTN = ".//*[@class='attr-btn']/button[1]"
......@@ -36,6 +36,7 @@ TOOL_BAR_EXPAND_ARROW = ".//i[@class='anticon anticon-down']"
ADDED_STATION_ICON = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][2]/*[name()='g']/*[name()='g']/*[name()='rect']"
ADDED_STATION_ICON_1 = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][1]/*[name()='g']/*[name()='g']/*[name()='rect']"
ADDED_STATION_ICON_ATTRIBUTE_3 = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][3]"
ADDED_STATION_ICON_ATTRIBUTE_1 = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][2]"
ADDED_STATION_ICON_ATTRIBUTE = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][2]"
ADDED_MULTIPLE_STATION_ICONS = ".//*[@class='station-svg']/div[1]/*[name()='svg']/*[name()='g']/*[name()='g']/*[name()='g'][2]/*[name()='g']"
#工位地图中的属性
......
......@@ -11,15 +11,15 @@ LOTS_CHECKBOX = ".//*[@class='ant-table-selection-column']/span[1]/div[1]/label[
LOTS_CHECKBOX_SPAN = ".//*[@class='ant-table-selection-column']/span[1]/div[1]/label[1]/span[1]"
MORE_OPERATION = '//*[@id="more"]/div[1]/div[7]/p/a'
#第一行工位数据信息
FIRST_LINE_EDIT_BTN = 'icon-edit_0'
FIRST_LINE_DELETE_BTN = "icon-delete_0"
FIRST_LINE_EDIT_BTN = '#main .ant-table-fixed-right tbody tr:first-child i:nth-child(1)'
FIRST_LINE_DELETE_BTN = "#main .ant-table-fixed-right tbody tr:first-child i:nth-child(2)"
FIRST_LINE_CHECKBOX = ".//*[@class='ant-table-tbody']/tr[1]/td[1]/span[1]/label[1]/span[1]/input[1]"
FIRST_LINE_DEPARTMENT = ".//*[@class='ant-table-tbody']/tr[1]/td[9]/li[1]"
FIRST_LINE_STATUS = ".//*[@class='ant-table-tbody']/tr[1]/td[11]"
FIRST_LINE_STATION_NUMBER = ".//*[@class='ant-table-tbody']/tr[1]/td[3]"
#第二行工位数据信息
SECOND_LINE_EDIT_BTN = "icon-edit_1"
SECOND_LINE_DELETE_BTN = "icon-delete_1"
SECOND_LINE_EDIT_BTN = "#main .ant-table-fixed-right tbody tr:nth-child(2) i:nth-child(1)"
SECOND_LINE_DELETE_BTN = "#main .ant-table-fixed-right tbody tr:nth-child(2) i:nth-child(2)"
SECOND_LINE_CHECKBOX = ".//*[@class='ant-table-tbody']/tr[2]/td[1]/span[1]/label[1]/span[1]/input[1]"
SECOND_LINE_DEPARTMENT = ".//*[@class='ant-table-tbody']/tr[2]/td[9]/li[1]"
SECOND_LINE_STATUS = ".//*[@class='ant-table-tbody']/tr[2]/td[10]"
......@@ -81,14 +81,14 @@ CLOSE_BTN = ".//*[@class='ant-modal-content']/button[1]"
DYNAMIC_WARNING_MSG = ".//*[@class='ant-message-notice-content']/div[1]/span[1]"
'''“批量编辑工位”页面中的元素'''
LOTS_DEPARTMENT_LIST = "/html/body/div[3]/div/div[2]/div/div[1]/div[2]/ul/li[1]/div/span/span/span"
LOTS_DEPARTMENT_LIST_TEXT = "/html/body/div[3]/div/div[2]/div/div[1]/div[2]/ul/li[1]/div/span/span/ul/li[1]"
LOTS_DEPARTMENT_LIST = "//body/div[last()]//ul[@class='form-group']/li[1]/div/span/span/span"
LOTS_DEPARTMENT_LIST_TEXT = "//body/div[last()-1]//ul[@class='form-group']/li[1]/div/span/span/ul/li[1]/span[2]"
LOTS_DEPARTMENT_LIST_TEXT_02 = "/html/body/div[3]/div/div[2]/div/div[1]/div[2]/ul/li[1]/div/span/span/ul/li[2]"
LOTS_STATUS_LIST = "/html/body/div[3]/div/div[2]/div/div[1]/div[2]/ul/li[2]/div/div/div/div/div"
LOTS_STATUS_LIST_TEXT = "[name='page.table.status'] .ant-select-selection-selected-value"
FIRST_DEPARTMENT_LIST = "/html/body/div[5]/div/div/div/ul/li[2]/span[2]"
SECOND_DEPARTMENT_LIST = "/html/body/div[4]/div/div/div/ul/li[3]/span[2]"
THIRD_DEPARTMENT_LIST = "/html/body/div[4]/div/div/div/ul/li[4]/span[2]"
LOTS_STATUS_LIST = "//body/div[last()]//ul[@class='form-group']/li[2]/div"
LOTS_STATUS_LIST_TEXT = "//body/div[last()-1]//ul[@class='form-group']/li[2]/div/div/div/div/div"
FIRST_DEPARTMENT_LIST = "//body/div[last()]//ul/li[2]/span[2]/span"
SECOND_DEPARTMENT_LIST = "//body/div[last()]//ul/li[3]/span[2]/span"
THIRD_DEPARTMENT_LIST = "//body/div[last()]//ul/li[4]/span[2]/span"
'''删除工位确认框'''
DELETE_STATION_CONFIRM_BOX_TEXT = "ant-confirm-title"
......
......@@ -7,7 +7,7 @@ CONFIRM_BTN = ".//*[@class='ant-modal-content']/div[3]/button[2]"
ADD_DEPARTMENT_TEXT_INPUT = "[name='department.manage.name']>input"
DEPARTMENT_MANAGEMENT_TEXT = ".//*[@id='main']/div/div[1]"
DEPARTMENT_SEARCH_RESULT_TEXT = ".//*[@id='main']/div/div[3]/div[2]/div/div/ul/li[1]"
EDIT_DEPARTMENT_BTN = '//*[@id="main"]/div/div[3]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[5]/span/i[1]'
EDIT_DEPARTMENT_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[1]//i[1]"
FIRST_LINE_DEPARTMENT_NAME_TEXT = ".//*[@class='ant-table-tbody']/tr[1]/td[2]/span[3]"
SECOND_LINE_DEPARTMENT_NAME_TEXT = ".//*[@class='ant-table-tbody']/tr[2]/td[2]/span[3]"
THIRD_LINE_DEPARTMENT_NAME_TEXT = ".//*[@class='ant-table-tbody']/tr[3]/td[2]/span[3]"
......@@ -26,8 +26,8 @@ SEARCH_BTN = ".//*[@class='filter clearfix']/ul[1]/li[2]/button[1]"
RESET_BTN = ".//*[@class='filter clearfix']/ul[1]/li[2]/button[2]"
SEARCH_RESULT_TEXT = ".//*[@class='ant-spin-container']/ul[1]/li[1]"
NO_DATA_TEXT = ".//*[@class='ant-table-placeholder']/span[1]"
DELETE_FIRST_LINE_BTN = ".//*[@class='ant-table-tbody']/tr[2]/td[5]/span[1]/i[2]"#新增的第一个,即第二条数据
DELETE_LAST_LINE_BTN = ".//*[@class='ant-table-tbody']/tr[last()]/td[5]/span[1]/i[2]"
DELETE_FIRST_LINE_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[2]//i[2]"#新增的第一个,即第二条数据
DELETE_LAST_LINE_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[last()]//i[2]"
LOT_SIZING_DELETE_BTN = ".//*[@id='main']/div/div[3]/div[1]/div[2]"
LOT_SIZING_CHECKBOX = ".//*[@class='ant-checkbox-wrapper']/span[1]/input[1]"
PAGE_NUM_1 = ".//*[@class='ant-spin-container']/ul[1]/li[3]"
......@@ -36,6 +36,9 @@ FIRST_LINE_CHECKBOX = ".//*[@class='ant-table-tbody']/tr[1]/td[1]/span/label/spa
LAST_LINE_CHECKBOX = ".//*[@class='ant-table-tbody']/tr[last()]/td[1]/span/label/span/input"
THIRD_LINE_CHECKBOX = ".//*[@class='ant-table-tbody']/tr[3]/td[1]/span/label/span/input"
DEPARTMENT_COLOR = "body .department-manage-color div div div"
DEPARTMENT_LAST_COLOR = ".sketch-picker > div:last-child > div:last-child div"
'''
删除确认框
......
ADDBUILD = ".//*[@id='main']/div/div[3]/div[1]/ul/li"
ADDBUILD_FLOOR = "body > div:nth-child(5) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > ul > li:nth-child(1) > div > input"
ADDBUILD_FLOOR = ".ant-modal-content .form-group li:first-child input"
ADDBUILD_PARK = "div[class ='ant-modal-body']>ul>li>[name='page.filter.park']"
ADDBUILD_BUILD = "div[class ='ant-modal-body']>ul>li>[name='page.filter.building']"
CLOSE_BUTTON = ".//*[@class='ant-modal-content']/button"
......
CREATE_BUILD_BUTTON = ".//*[@class='operation-list']/li"
CREATE_OVERLAY_TITLE=".//*[@id='rcDialogTitle0']"
CREATE_OVERLAY_BULIDNAME = "div[class='ant-modal-body']>ul>li>[name='page.filter.building']>input"
CREATE_OVERLAY_CHOOSE_PART = "body > div:nth-child(5) > div > div.ant-modal-wrap > div > div.ant-modal-content > div.ant-modal-body > ul > li:nth-child(2) > div > div > div > div"
CREATE_OVERLAY_CHOOSE_PART = ".form-content .ant-select-selection__rendered"
CREATE_OVERLAY_CHOOSE_PART_FLAG = "html/body/div[4]/div/div/div/ul/li[2]"
CREATE_OVERLAY_BUILDTOKEN = "[name='page.filter.adsNo']>input"
CREATE_OVERLAY_UPLOAD_IMG ="[name='page.filter.ads']>span>div>span>button"
......@@ -9,7 +9,7 @@ CREATE_OVERLAY_CANCEL_BUTTON =".//*[@class='ant-modal-content']/div[3]/button[1]
CREATE_OVERLAY_CLOSE_BUTTON =".//*[@class='ant-modal-content']/button"
ADVERTISEMENT = ".//*[@class = 'form-group']/li[4]/div/span/div[1]/span/button"
CREATE_OVERLAY_DETERMINE_BUTTON = ".//*[@class='ant-modal-content']/div[3]/button[2]"
EDIT_BUILD_BUTTON='//*[@id="main"]/div/div[2]/div[2]/div/div/div/div/div/div/table/tbody/tr[1]/td[6]/span/i[1]'
EDIT_BUILD_BUTTON='//div[@class="ant-table-fixed-right"]//tbody/tr[1]//i[1]'
EDIT_OVERLAY_CHOOSE_PART_FLAG = "//*[@class='ant-select-dropdown-menu-item-active ant-select-dropdown-menu-item-selected ant-select-dropdown-menu-item']"
SEARCH_PARK="[name='page.filter.park'] .ant-select-selection__rendered"
SEARCH_PARK_LIST=".//*[@id='main']/div[2]/div/div/div/ul/li[2]"
......@@ -20,7 +20,7 @@ SEARCH_BUTTON02=".//*[@id='main']/div[1]/div[2]/ul/li[3]/div/button[1]"
SEARCH_RESET_BUTTON01=".//*[@id='main']/div[1]/div[2]/ul/li[2]/div/button[2]"
SEARCH_RESET_BUTTON02=".//*[@id='main']/div[1]/div[2]/ul/li[3]/div/button[2]"
SEARCH_RESULT=".//*[@id='main']/div/div[2]/div[2]/div/div/ul/li[1]"
DELETE_BUILD_ICON=".//i[@class='iconfont icon-delete page-option-icon ']"
DELETE_BUILD_ICON="//div[@class='ant-table-fixed-right']//tbody/tr[1]//i[2]"
DELETE_OVERLAY_TITLE="/html/body/div[3]/div/div[2]/div/div[1]/div/div/div[1]/span"
DELETE_BUILD_CONFIRM_BUTTON=".//button[@class='ant-btn ant-btn-primary ant-btn-lg']"
DELETE_BUILDE_CANCEL_BUTTON=".//button[@class='ant-btn ant-btn-lg']"
......
......@@ -2,15 +2,15 @@
PAGE_TITLE = ".//*[@class='ant-breadcrumb']/span[3]/span[1]/span[1]"
USER_BOX_TITLE = ".//*[@class='ant-modal-header']/div[1]"
ADD_USER_BTN = ".//*[@class='page-pointer']"
EDIT_USER_BTN = ".//*[@class = 'page-table-column-option']/span[1]/i[1]"
EDIT_USER_BTN = ".//*[@class = 'ant-table-body-inner']/table/tbody/tr[1]/td[1]/span[1]/i[1]"
DELETE_USER_BTN = ".//*[@class = 'page-table-column-option']/span[1]/i[2]"
LOTS_DELETE_BTN = ".//*[@class='clearfix page-option']/div[2]"
DEPARTMENT_SEARCH_INPUT = "[name='page.filter.dept'] .ant-select-selection-selected-value"
USER_NAME_SEARCH_INPUT = "[name='page.filter.name'] input"
USER_NAME_SEARCH_INPUT = "[name='seat.station.employee'] input"
SEARCH_BTN = ".//*[@class='buttons']/li[1]/button[1]"
RESET_BTN = ".//*[@class='buttons']/li[1]/button[2]"
FIRST_DEPARTMENT_SELECT = ".//*[@id='main']/div[2]/div/div/div/ul/li[2]"
SECOND_LINE_DELETE_BTN = ".//*[@class='ant-table-tbody']/tr[2]/td[10]/span[1]/i[2]"
SECOND_LINE_DELETE_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[2]//i[2]"
LOTS_CHECKBOX = ".//*[@class='ant-table-selection']/label[1]/span[1]/input[1]"
FIRST_PAGE_BTN = ".//*[@class='ant-pagination ant-table-pagination']/li[3]"
SECOND_PAGE_BTN = ".//*[@class='ant-pagination ant-table-pagination']/li[4]"
......
......@@ -4,8 +4,8 @@ SEARCH_PARK_SEARCH_BTN = ".//*[@id='main']/div/div[2]/ul/li[2]/button[1]"
SEARCH_PARK_RESET_BTN = ".//*[@id='main']/div/div[2]/ul/li[2]/button[2]"
SEARCH_RESULT_TEXT = ".//*[@id='main']/div/div[3]/div[2]/div/div/ul/li[1]"
CREAT_PARK = ".//*[@id='main']/div/div[3]/div[1]/ul/li"
EDIT_PARK_BTN = ".//*[@id='main']/div/div[3]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[8]/a/i[1]"
DELETE_FIRST_PARK_BTN = ".//*[@id='main']/div/div[3]/div[2]/div/div/div/div/div/div/table/tbody/tr[1]/td[8]/a/i[2]"
EDIT_PARK_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[1]//i[1]"
DELETE_FIRST_PARK_BTN = "//div[@class='ant-table-fixed-right']//tbody/tr[1]//i[2]"
PARK_MANAGEMENT_TEXT = ".//*[@id='workstationIndex']/div/div/div[2]/div/div/div[2]/div/span[3]/span[1]/span"
NO_DATA_MSG = ".ant-table-scroll .ant-table-placeholder"
FIRST_ITEM_PARK = "#main > div > div.m20 > div.ant-table-wrapper > div > div > div > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(2)"
......@@ -46,6 +46,7 @@ AFTERNOON_START_TIME = "/html/body/div[8]/div/div/div/div[1]/input"
AFTERNOON_START_TIME1 = "html/body/div[8]/div/div/div/div[1]/input"
AFTERNOON_END_TIME = "/html/body/div[9]/div/div/div/div[1]/input"
AFTERNOON_END_TIME1 = "html/body/div[9]/div/div/div/div[1]/input"
TIME_INPUT='.ant-time-picker-panel-input-wrap .ant-time-picker-panel-input '
CLOSE_BUTTON = ".//*[@class='ant-modal-content']/button"
CLOSE_BUTTON = ".//*[@class='ant-modal-content']/div[3]/button[1]"
CANCEL_BTN = ".//*[@class='ant-modal-content']/div[3]/button[1]"
......
......@@ -25,13 +25,13 @@ def edit_park(browser,msg,morning_start_time,morning_end_time,afternoon_start_ti
logging.info("else"+elem[0])
browser.click_element(elem[0])
browser.click_element(xtpz_yqgl.MORNING_START,By.CSS_SELECTOR)
browser.sendkeys_to_element(xtpz_yqgl.MORNING_START_TIME,morning_start_time)
browser.sendkeys_to_element(xtpz_yqgl.TIME_INPUT,morning_start_time,By.CSS_SELECTOR)
browser.click_element(xtpz_yqgl.MORNING_END,By.CSS_SELECTOR)
browser.sendkeys_to_element(xtpz_yqgl.MORNING_END_TIME,morning_end_time)
browser.sendkeys_to_element(xtpz_yqgl.TIME_INPUT,morning_end_time,By.CSS_SELECTOR)
browser.click_element(xtpz_yqgl.AFTERNOON_START,By.CSS_SELECTOR)
browser.sendkeys_to_element(xtpz_yqgl.AFTERNOON_START_TIME,afternoon_start_time)
browser.sendkeys_to_element(xtpz_yqgl.TIME_INPUT,afternoon_start_time,By.CSS_SELECTOR)
browser.click_element(xtpz_yqgl.AFTERNOON_END,By.CSS_SELECTOR)
browser.sendkeys_to_element(xtpz_yqgl.AFTERNOON_END_TIME,afternoon_end_time)
browser.sendkeys_to_element(xtpz_yqgl.TIME_INPUT,afternoon_end_time,By.CSS_SELECTOR)
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment