def inputDueData_Red(self, Due=None): e = self.driver.find_element_by_xpath( '//*[@id="editBox"]/div/div/div[2]/div/p[3]/input') if Due is None or Due == "": # 如果传入了值,则进行操作,没有传值则返回元素 return e await_ele.judgeEle(e) # 点击元素 elementaction.inputContent(self, e, Due) # 输入商品
def optionCounty(self, County=None): # 传入区县 e = self.driver.find_element_by_xpath('//*[@id="f3"]') # 点击区县下拉框 await_ele.judgeEle(e) # 点击元素 countys = self.driver.find_elements_by_xpath(r'//*[@id="f3"]/option') if County is None or County == "": # 如果没有传入区县或传的是'""'则直接返回省份名组 return countys elementaction.dropDownBox_text(self, countys, County)
def clickCancel(self, action=None): # 查看元素是否为用户可见(返回True或FALSE) e = self.driver.find_element_by_xpath( '//*[@id="locationEditModal"]/div[3]/button[2]') if action is not None: # 如果没有传入值,则进行操作,有传值则返回元素 return e await_ele.judgeEle(e) # 点击元素
def clickNo(self, action=None): e = self.driver.find_element_by_xpath( '//*[@id="locationEditModal"]/div[2]/ul/li[5]/div/div[2]/label/input' ) if action is not None: # 如果没有传入值,则进行操作,有传值则返回元素 return e await_ele.judgeEle(e) # 点击元素
def inputCategory(self, Category=None): # 传入类目 e = WebDriverWait(self.driver, 30).until( lambda driver: driver.find_element_by_name("categorySecondCode")) if Category is None or Category == "": # 如果传入了值,则进行操作,没有传值则返回元素 return e await_ele.judgeEle(e) # 点击元素 elementaction.inputContent(self, e, Category) # 输入类目
def optionProvince(self, Province=None): # 传入省份 e = self.driver.find_element_by_xpath('//*[@id="f1"]') # 点击省份下拉框 await_ele.judgeEle(e) # 点击元素 # 获取省份名组 provinces = self.driver.find_elements_by_xpath(r'//*[@id="f1"]/option') if Province is None or Province == "": # 如果没有传入省份或传的是'""'则直接返回省份名组 return provinces elementaction.dropDownBox_text(self, provinces, Province)
def inputAddressCode(self, AddressCode=None): e = self.driver.find_element_by_xpath( '//*[@id="locationEditModal"]/div[2]/ul/li[1]/div/div[1]/div[1]/div/input' ) if AddressCode is None or AddressCode == "": # 如果传入了值,则进行操作,没有传值则返回元素 return e await_ele.judgeEle(e) # 点击元素 elementaction.inputContent(self, e, AddressCode)
def optionAuditState(self, AuditState=None): e = self.driver.find_element_by_name("auditStatus") await_ele.judgeEle(e) AuditStates = self.driver.find_elements_by_xpath( r'//select[@name="auditStatus"]/option') if AuditState is None or AuditState == "": # 如果没有传入值或传的是'""'则直接返回库位名组 return AuditStates elementaction.dropDownBox_text(self, AuditStates, AuditState)
def optionOutPutState(self, OutPutState=None): # 出入库状态 e = self.driver.find_element_by_id("storageStatus") await_ele.judgeEle(e) # 点击出入库状态 # 选择出入库状态 OutPutStates = self.driver.find_elements_by_xpath(r'//select[@id="storageStatus"]/option') if OutPutState is None or OutPutState == "": # 如果没有传入值或传的是'""'则直接返回库位名组 return OutPutStates elementaction.dropDownBox_text(self, OutPutStates, OutPutState) # 出入库状态
def optionAllotNumberState(self, AllotNumberState=None): # 调拨单状态 e = self.driver.find_element_by_id("auditStatus") await_ele.judgeEle(e) # 点击调拨单状态 # 选择调拨单状态 AllotNumberStates = self.driver.find_elements_by_xpath(r'//select[@id="auditStatus"]/option') if AllotNumberState is None or AllotNumberState == "": # 如果没有传入值或传的是'""'则直接返回库位名组 return AllotNumberStates elementaction.dropDownBox_text(self, AllotNumberStates, AllotNumberState) # 调拨单状态
def optionAllotType(self, AllotType=None): # 调拨类型 e = self.driver.find_element_by_id("allotType") await_ele.judgeEle(e) # 点击调拨类型 # 选择调拨类型 AllotTypes = self.driver.find_elements_by_xpath(r'//select[@id="allotType"]/option') if AllotType is None or AllotType == "": # 如果没有传入调拨类型或传的是'""'则直接返回库位名组 return AllotTypes elementaction.dropDownBox_text(self, AllotTypes, AllotType) # 调拨类型
def optionShopState(self, ShopState=None): # 传入区县 e = self.driver.find_element_by_id('shopStatus') # 点击区县下拉框 await_ele.judgeEle(e) # 点击元素 ShopStates = self.driver.find_elements_by_xpath( r'//*[@id="shopStatus"]/option') if ShopState is None or ShopState == "": # 如果没有传入区县或传的是'""'则直接返回省份名组 return ShopStates elementaction.dropDownBox_text(self, ShopStates, ShopState)
def __init__(self, driver): self.driver = driver joinmodule.joinModule(self, "list4") # 进入“库存管理”模块:库存管理的‘for’属性值为“list4” e = WebDriverWait( self.driver, 30).until(lambda driver: driver.find_element_by_link_text("效期规则")) await_ele.judgeEle(e, second=20, await_second=0.3) # 点击元素
def optionJoinWarehouse(self, WareHouse=None): # 传入仓名 e = self.driver.find_element_by_id("inWarehouseCode") # 点击仓库下拉框 await_ele.judgeEle(e) # 点击元素 # 获取仓库名组 wareHouses = self.driver.find_elements_by_xpath(r'//select[@id="inWarehouseCode"]/option') if WareHouse is None or WareHouse == "": # 如果没有传入仓库或传的是'""'则直接返回仓库名组 return wareHouses elementaction.dropDownBox_text(self, wareHouses, WareHouse) # 选择仓库名
def optionSign(self, Sign=None): # 传入标记 e = self.driver.find_element_by_name("sign") # 获取标记下拉框元素 await_ele.judgeEle(e, second=20) # 点击元素 # 获取标记名组 Signs = self.driver.find_elements_by_xpath(r'//*[@name="sign"]/option') if Sign is None or Sign == "": # 如果没有传入仓库或传的是'""'则直接返回仓库名组 return Sign elementaction.dropDownBox_text(self, Signs, Sign) # 选择仓库名
def optionOrderState(self, OrderState=None): e = self.driver.find_element_by_name("auditStatus") await_ele.judgeEle(e) # 点击元素 OrderStates = self.driver.find_elements_by_xpath( r'//select[@name="auditStatus"]/option') if OrderState is None or OrderState == "": # 如果没有传入或传的是'""'则直接返回元素名组 return OrderStates elementaction.dropDownBox_text(self, OrderStates, OrderState)
def joinScm(self): driver = self.driver es = driver.find_elements_by_xpath('//*[@id="root"]/div/div[1]/ul/li') # 点击SCM for e in es: if e.text == "SCM": # 获取标签的值,判断是否为SCM await_ele.judgeEle(e, second=20, await_second=0.3) # 点击元素 break
def optionInventoryState(self, InventoryState=None): e = self.driver.find_element_by_name("storageStatus") await_ele.judgeEle(e) # 点击元素 InventoryStates = self.driver.find_elements_by_xpath( r'//select[@name="storageStatus"]/option') if InventoryState is None or InventoryState == "": # 如果没有传入或传的是'""'则直接返回元素名组 return InventoryStates elementaction.dropDownBox_text(self, InventoryStates, InventoryState)
def optionJoinStorageLocation(self, StorageLocation=None): # 传入库位名 e = self.driver.find_element_by_id("inLocationCode") await_ele.judgeEle(e) # 点击库位 # 选择库位 storageLocations = self.driver.find_elements_by_xpath(r'//select[@id="inLocationCode"]/option') if StorageLocation is None or StorageLocation == "": # 如果没有传入库位或传的是'""'则直接返回库位名组 return storageLocations elementaction.dropDownBox_text(self, storageLocations, StorageLocation) # 选择库位名
def optionCity(self, WareHouse=None): # 传入城市 e = self.driver.find_element_by_id("cityList") # 点击城市下拉框 await_ele.judgeEle(e) # 点击元素 # 获取城市名组 wareHouses = self.driver.find_elements_by_xpath( r'//select[@id="cityList"]/option') if WareHouse is None or WareHouse == "": # 如果没有传入城市或传的是'""'则直接返回省份名组 return wareHouses elementaction.dropDownBox_text(self, wareHouses, WareHouse) # 选择城市名
def clickClose(self, action=None): es = self.driver.find_elements_by_xpath( '//*[@id="alert"]/div/div/div[3]/button') for e in es: if e.text == '关闭': if action is not None: return e await_ele.judgeEle(e) # 点击元素 break
def optionCity(self, City=None): # 传入城市 e = self.driver.find_element_by_id("cityList") # 点击城市下拉框 await_ele.judgeEle(e) # 点击元素 # 获取城市名组 citys = self.driver.find_elements_by_xpath( '//*[@id="cityList"]/option') if City is None or City == "": # 如果没有传入城市或传的是'""'则直接返回省份名组 return citys elementaction.dropDownBox_text(self, citys, City)
def optionWarehouse(self, WareHouse=None): e = self.driver.find_element_by_name("warehouseCode") await_ele.judgeEle(e) # 点击元素 # 获取仓库名组 wareHouses = self.driver.find_elements_by_xpath( r'//select[@name="warehouseCode"]/option') if WareHouse is None or WareHouse == "": # 如果没有传入或传的是'""'则直接返回元素名组 return wareHouses elementaction.dropDownBox_text(self, wareHouses, WareHouse)
def optionStockRemovalState(self, StockRemovalState=None): e = self.driver.find_element_by_name("outStatus") await_ele.judgeEle(e) # 点击元素 StockRemovalStates = self.driver.find_elements_by_xpath( r'//select[@name="outStatus"]/option') if StockRemovalState is None or StockRemovalState == "": # 如果没有传入或传的是'""'则直接返回元素名组 return StockRemovalStates elementaction.dropDownBox_text(self, StockRemovalStates, StockRemovalState)
def optionProvince(self, WareHouse=None): # 传入省份 e = self.driver.find_element_by_id("f1") # 点击省份下拉框 await_ele.judgeEle(e) # 点击元素 # 获取省份名组 wareHouses = self.driver.find_elements_by_xpath( r'//select[@id="f1"]/option') if WareHouse is None or WareHouse == "": # 如果没有传入省份或传的是'""'则直接返回省份名组 return wareHouses elementaction.dropDownBox_text(self, wareHouses, WareHouse) # 选择省份名
def joinGoodsRule(self, action=None): e = WebDriverWait( self.driver, 30).until(lambda driver: driver.find_element_by_link_text("下架规则")) if action is not None: # 如果没有传入值,则进行操作,有传值则返回元素 return e await_ele.judgeEle(e, second=20) # 进入“下架规则_类目”页面 e1 = WebDriverWait( self.driver, 30).until(lambda driver: driver.find_element_by_link_text("商品维度")) await_ele.judgeEle(e1, second=20) # 进入“下架规则_商品”页面
def optionCityNewAdd(self, City=None): # 传入城市 e = self.driver.find_element_by_xpath( '//div/div[2]/div/select[@id="f2"]') # 点击城市下拉框 await_ele.judgeEle(e) # 点击元素 # 获取城市名组 sleep(0.5) citys = self.driver.find_elements_by_xpath( '//div/div[2]/div/select[@id="f2"]/option') if City is None or City == "": # 如果没有传入城市或传的是'""'则直接返回省份名组 return citys elementaction.dropDownBox_text(self, citys, City)
def __init__(self, driver): self.driver = driver joinmodule.joinModule(self, "list4") # 进入“库存管理”模块:库存管理的‘for’属性值为“list4” e = WebDriverWait( self.driver, 30).until(lambda driver: driver.find_element_by_link_text("下架规则")) await_ele.judgeEle(e) # 进入“下架规则_类目”页面 e1 = WebDriverWait( self.driver, 30).until(lambda driver: driver.find_element_by_link_text("商品维度")) await_ele.judgeEle(e1, second=20) # 进入“下架规则_商品”页面
def clickExport(self, action=None): e = self.driver.find_element_by_id("export") if action is not None: # 如果没有传入值,则进行操作,有传值则返回元素 return e await_ele.judgeEle(e)
def inputCategory(self, Category=None): # 传入类目 e = self.driver.find_element_by_id("categoryCodeOrName") if Category is None or Category == "": # 如果传入了值,则进行操作,没有传值则返回元素 return e await_ele.judgeEle(e) elementaction.inputContent(self, e, Category) # 输入类目