def test3(self, driver): eu = ElementUtil() #受入确认 eu.click(driver, 15, '受入确认', *self.ShouRuQueRen) #纳入场所 Wait(driver, 10, 2).elementwait( lambda the_driver: the_driver.find_element(*self.NaRuChangSuo)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.NaRuChangSuo).send_keys(self.NaRuChangSuo1)) driver.find_element(*self.NaRuChangSuoXuanZe).click() # 检索 driver.find_element(*self.JianSuo).click()
def test6(self, driver): eu = ElementUtil() # 受入确认 eu.click(driver, 15, '受入确认', *self.ShouRuQueRen) #纳入指示结束日 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.OpenEndCalendar)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.OpenEndCalendar).click()) Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.EndDate1)) Wait(driver, 10).until( lambda the_driver: the_driver.find_element(*self.EndDate1).click()) #纳入指示开始日 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver. find_element(*self.OpenStartCalendar)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.OpenStartCalendar).click()) Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.StartDate1)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.StartDate1).click()) # 检索 eu.click(driver, 15, '受入确认', *self.JianSuo) sleep(6) success_text = driver.find_element(*self.JieGuo).text return success_text
def INV_search01(self, driver): Browser(driver, 10).click(self.SA_button_element) Browser(driver, 10).click(self.newlyBuilt_element) Browser(driver, 10).click(self.INV_add_element) Wait(driver, 10).elementwait(lambda x: x.find_element(*self.IV_NO_element)) Browser(driver, 10).send_keys(self.IV_NO_element, self.IV_NO) Browser(driver, 10).click(self.IV_NO_search_element) Wait(driver, 10).elementwait(lambda the_driver: the_driver. find_element(*self.IV_NO_get_element)) element_list = driver.find_elements(*self.IV_NO_get_element) datas = [] for i in element_list: datas.append(i.text) return datas, self.IV_NO
def test19(self, driver): explain = "INV P/L登录无償新規 test19在Package List详细中选择P/O记录执行删除操作 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 无償新規 self.e.click(driver, 15, explain, *self.WuChangXinGui) # 点击 無償商品登録行追加 self.e.click(driver, 15, explain, *self.test19BL_shangpinzhuijia) sleep(2) # 检索 self.e.click(driver, 15, explain, *self.POSearch_element) sleep(4) # 点击任意一条数据 # driver.find_element(*self.test15BL_shuju).send_keys(Keys.SPACE) # self.e.click(driver, 15, explain, *self.test15BL_shuju) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test19BL_xuanzeshuju)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_xuanzeshuju).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test19BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写FOB单价 self.e.send_keys(driver, 15, self.test19danjia, explain, *self.test19BL_danjia) # 填写商品数量 self.e.send_keys(driver, 15, self.test19shuliang, explain, *self.test19BL_shuliang) # INVOICE详细中选择数据 self.e.click(driver, 15, explain, *self.test19BL_shujuxuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.WplDengLu) # Package List详细中选择数据 self.e.click(driver, 15, explain, *self.test19BL_PLxuanze) # 点击削除 self.e.click(driver, 15, explain, *self.WplXiaoChu) # 是否消除 self.e.click(driver, 15, explain, *self.test18BL_shifouxiaoshu) sleep(2) Actual_result = self.e.getText(driver, 15, explain, *self.test18BL_actual_result) # 确认消除 self.e.click(driver, 15, explain, *self.test18BL_querenxiaochu) return Actual_result
def test17(self, driver): explain = "INV P/L登录无償新規 test17填写识别番号 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 无償新規 self.e.click(driver, 15, explain, *self.WuChangXinGui) # 点击 無償商品登録行追加 self.e.click(driver, 15, explain, *self.test15BL_shangpinzhuijia) sleep(2) # 检索 self.e.click(driver, 15, explain, *self.POSearch_element) sleep(4) # 点击任意一条数据 # driver.find_element(*self.test15BL_shuju).send_keys(Keys.SPACE) # self.e.click(driver, 15, *self.test15BL_shuju) Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_shuju)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shuju).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test15BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写FOB单价 self.e.send_keys(driver, 15, self.test15danjia, explain, *self.test15BL_danjia) # 填写商品数量 self.e.send_keys(driver, 15, self.test15shuliang, explain, *self.test15BL_shuliang) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.test15BL_xuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.WplDengLu) # 填写集装箱开始号 self.e.send_keys(driver, 15, self.test16csn, explain, *self.test16BL_csn) # 填写集装箱结束号 self.e.send_keys(driver, 15, self.test16cen, explain, *self.test16BL_cen) # 填写识别番号 self.e.send_keys(driver, 15, self.test17shibiefanhao, explain, *self.test17BL_shibiefanhao) success_text = "OK" return success_text
def test5(self, driver): eu = ElementUtil() # 受入确认 eu.click(driver, 15, '受入确认', *self.ShouRuQueRen) #纳入指示日 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.KaiShiRi)) Wait(driver, 10).until( lambda the_driver: the_driver.find_element(*self.KaiShiRi).click()) Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.StartRiQi)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.StartRiQi).click()) #检索 eu.click(driver, 15, '受入确认', *self.JianSuo) sleep(6) success_text = driver.find_element(*self.JieGuo).text return success_text
def search_and_click(driver, locator1, locator2, locator3): """ :param driver:驱动实例 :param locator1:勾选框 :param locator2:翻页 :param locator3:常见元素 """ Wait(driver, 10).elementwait(lambda x: x.find_element(*locator3)) element_list = driver.find_elements(*locator1) while element_list == []: Browser(driver, 10).click(locator2) Wait(driver, 10).elementwait(lambda x: x.find_element(*locator3)) element_list = driver.find_elements(*locator1) while element_list != []: try: return choice(element_list).send_keys(Keys.SPACE) except WebDriverException: sleep(1) return choice(element_list).send_keys(Keys.SPACE)
def test7(self, driver): eu = ElementUtil() # 受入确认 eu.click(driver, 15, '受入确认', *self.ShouRuQueRen) #输送形态 Wait(driver, 10, 2).elementwait( lambda the_driver: the_driver.find_element(*self.ShuSongXinTai)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.ShuSongXinTai).click()) Wait(driver, 10, 2).elementwait(lambda the_driver: the_driver.find_element( *self.ShuSongXinTaiXuanZe)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.ShuSongXinTaiXuanZe).click()) # 检索 eu.click(driver, 15, '受入确认', *self.JianSuo) sleep(6) success_text = driver.find_element(*self.JieGuo).text return success_text
def test9(self, driver): eu = ElementUtil() # 受入确认 eu.click(driver, 15, '受入确认', *self.ShouRuQueRen) sleep(3) # 状态下拉框 eu.click(driver, 15, '受入确认', *self.ZhuangTai) # 状态选择 eu.click(driver, 15, '受入确认', *self.ZhuangTaiXuanZe) #检索 eu.click(driver, 15, '受入确认', *self.JianSuo) #数据选择 Wait(driver, 10, 3).elementwait( lambda the_driver: the_driver.find_element(*self.ShuJuXuanZe1)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.ShuJuXuanZe1).click()) #拖动滚动条到最顶部 10000为底部 scro = "document.documentElement.scrollTop=0" driver.execute_script(scro) #パターン設定 eu.click(driver, 15, '受入确认', *self.MoShiSheDing) sleep(3) #点击配送パターン eu.click(driver, 15, '受入确认', *self.PeiSongMoShi) sleep(3) #配送模式 eu.click(driver, 15, '受入确认', *self.ShuRuMoShi) eu.click(driver, 15, '受入确认', *self.XuanZeShuRuMoShi) #模式保存 eu.click(driver, 15, '受入确认', *self.MoShiBaoCun) sleep(3) #保存 eu.click(driver, 15, '受入确认', *self.BaoCun) sleep(6) #确认 eu.click(driver, 15, '受入确认', *self.QueRenBaoCunJi)
def checkPOAddOne(self, driver): """ 无償新規的 选择1条P/O记录进行P/L登录,Package List显示对应的记录 :param driver: :return: """ """检索P/L使用到INVOICE 详细""" explain = "INV P/L登录无償新規 test01CheckPOAddOne" # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVPL_element) # 点击 无償新規 self.e.click(driver, 15, explain, *self.Free_element) # 点击 無償商品登録行追加 self.e.click(driver, 15, explain, *self.POAdd_element) sleep(4) # 点击 検索 # self.e.click(driver,5,explain,*self.POSearch_element) # 点击任意一条数据 # kk = driver.find_element(*self.POChoiseOne_element) # driver.execute_script("arguments[0].click();", kk) # self.e.click(driver,5,*self.POChoiseOne_element) driver.find_element(*self.POChoiseOne_element).send_keys(Keys.SPACE) # 点击使用 self.e.click(driver, 15, explain, *self.POUse_element) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写商品数量 # self.e.clear(driver,5,*self.PONum1st_element) self.e.send_keys(driver, 15, self.PONum, explain, *self.PONum1st_element) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.POAll_element) # 点击P/L登録 self.e.click(driver, 15, explain, *self.PLReg_element) sleep(1) """查看Package List详情是否显示与INVOICE 详细对应记录""" # Package List详情 的社内品番 acCoNum = self.e.getText(driver, 15, explain, *self.PLConNo1st_element) # Package List详情 的数量 PLNum = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.PLNum1st_element).get_attribute("value")) return acCoNum, PLNum, self.PONum
def newlyBuilt11(self, driver): """ 新建海运,送信 """ Browser(driver, 10).click(self.SA_button_element) Browser(driver, 10).click(self.newlyBuilt_element) Browser(driver, 10).click(self.INV_add_element) Browser(driver, 10).click(self.IV_NO_element) Browser(driver, 10).click(self.IV_NO_search_element) Browser(driver, 10).choice_check_box(self.choose_click_element) Browser(driver, 10).click(self.IV_list_add_element) message = 'test' + str(time())[-6:] Browser(driver, 10).click(self.Master_BL_NO_element) Browser(driver, 10).send_keys(self.Master_BL_NO_element, message) Browser(driver, 10).send_keys(self.House_BL_NO_element, message) choose_date(driver, self.trust_day_element, self.trust_day_click_element, self.trust_day_month_element) choose_date(driver, self.issue_date_element, self.issue_date_click_element, self.issue_month_click_element) choose_date(driver, self.ETA_element, self.ETA_click_element, self.ETA_month_clikc_element) choose_date(driver, self.export_declaration_date_element, self.export_declaration_date_click_element, self.export_declaration_month_click_element) Browser(driver, 10).click(self.shipping_co_element) Browser(driver, 10).choice_select(self.shipping_co_choice_element) transport_text = driver.find_element(*self.transport_mode_element).text if transport_text == "SEA": Browser(driver, 10).send_keys(self.loading_method_element, Keys.SPACE) Browser(driver, 10).choice_select(self.loading_method_choice_elements) element_text = Browser(driver, 10).get_text( self.loading_method_get_element) if element_text == 'FCL': NO_elements = driver.find_elements(*self.container_NO_element) size_elements = driver.find_elements( *self.container_size_element) for no in range(len(NO_elements)): NO_elements[no].send_keys('New Practice 2') size_elements[no].click() Browser(driver, 10).choice_select( self.container_size_choice_element) Browser(driver, 10).send_keys(self.SI_NO_element, "test007") Browser(driver, 10).click(self.customs_broker_element) Browser(driver, 10).choice_select(self.customs_broker_choice_element) Browser(driver, 10).click(self.cargo_type_element) Browser(driver, 10).choice_select(self.cargo_type_choice_element) Browser(driver, 10).send_keys(self.INV_checklist_element, Keys.SPACE) driver.execute_script("var q=document.documentElement.scrollTop=0") Browser(driver, 10).click(self.file_upload_element) Browser(driver, 10).send_keys(self.INV_upload_element, Keys.SPACE) Browser(driver, 10).send_keys(self.upload_button_element, self.path) Browser(driver, 10).send_keys(self.close_button_element, Keys.ENTER) Browser(driver, 10).send_keys(self.BL_upload_element, Keys.SPACE) Browser(driver, 10).send_keys(self.upload_button_element, self.path) Browser(driver, 10).send_keys(self.close_button_element, Keys.ENTER) Browser(driver, 10).click(self.popup_return_element) Browser(driver, 10).click(self.temporary_saving_element) Browser(driver, 10).click(self.confirm_button_element) Wait(driver, 10).elementwait(lambda x: x.find_element(*self.return_element)) button = Browser(driver, 10).get_attribute(self.sending_confirmation_element, "style") if button == "display: none;": Browser(driver, 10).click(self.saving_element) else: Browser(driver, 10).click(self.sending_confirmation_element) Browser(driver, 10).click(self.sending_cancel_element) Browser(driver, 10).click(self.return_element) print(message) return message
def test18(self, driver): # INV 登录 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.INVpldenglu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.INVpldenglu).click()) # 无偿新规 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WuChangXinGui)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WuChangXinGui).click()) # 无偿商品登录追加 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test15BL_shangpinzhuijia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shangpinzhuijia).click()) # 选择第一条数据 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test18BL_xuanzeshuju)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_xuanzeshuju).click()) # 点击使用 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_shiyong)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shiyong).click()) # 填写FOB单价 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_danjia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_danjia).send_keys(self.test15danjia)) # 填写数量 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver. find_element(*self.test15BL_shuliang)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shuliang).send_keys(self.test15shuliang)) #INVOICE详细中选择数据削除 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_xuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_xuanze).click()) #削除 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test18BL_xiaochu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_xiaochu).click()) #是否消除 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test18BL_shifouxiaoshu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_shifouxiaoshu).click()) #确认消除 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test18BL_querenxiaochu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_querenxiaochu).click()) Actual_result = driver.find_element(*self.test18BL_actual_result).text return Actual_result
def test16(self, driver): #INV 登录 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.INVpldenglu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.INVpldenglu).click()) # 无偿新规 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WuChangXinGui)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WuChangXinGui).click()) #无偿商品登录追加 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test15BL_shangpinzhuijia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shangpinzhuijia).click()) #选择第一条数据 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_shuju)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shuju).click()) #点击使用 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_shiyong)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shiyong).click()) #填写FOB单价 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_danjia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_danjia).send_keys(self.test15danjia)) #填写数量 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver. find_element(*self.test15BL_shuliang)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_shuliang).send_keys(self.test15shuliang)) #勾选数据 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test15BL_xuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test15BL_xuanze).click()) #P/L登录 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WplDengLu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WplDengLu).click()) #填写Carton Start NO Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test16BL_csn)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test16BL_csn).send_keys(self.test16csn)) #填写Carton End NO Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test16BL_cen)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test16BL_cen).send_keys(self.test16cen)) success_text = "OK" return success_text
def newlyBuilt09(self, driver): """ 新建海运,送信 """ Browser(driver, 10).click(self.SA_button_element) Browser(driver, 10).click(self.newlyBuilt_element) Browser(driver, 10).click(self.INV_add_element) Browser(driver, 10).click(self.IV_NO_element) Browser(driver, 10).click(self.IV_NO_search_element) Browser(driver, 10).choice_check_box(self.choose_click_element) Browser(driver, 10).click(self.IV_list_add_element) message = 'test' + str(time())[-6:] Browser(driver, 10).click(self.Master_BL_NO_element) Browser(driver, 10).send_keys(self.Master_BL_NO_element, message) Browser(driver, 10).send_keys(self.House_BL_NO_element, message) choose_date(driver, self.trust_day_element, self.trust_day_click_element, self.trust_day_month_element) choose_date(driver, self.issue_date_element, self.issue_date_click_element, self.issue_month_click_element) choose_date(driver, self.ETA_element, self.ETA_click_element, self.ETA_month_clikc_element) choose_date(driver, self.export_declaration_date_element, self.export_declaration_date_click_element, self.export_declaration_month_click_element) Browser(driver, 10).click(self.shipping_co_element) Browser(driver, 10).choice_select(self.shipping_co_choice_element) transport_text = driver.find_element(*self.transport_mode_element).text if transport_text != "AIR": Browser(driver, 10).click(self.transport_type_clear_element) Browser(driver, 10).send_keys(self.transport_type_element, Keys.ENTER) Browser(driver, 10).click(self.AIR_element) Browser(driver, 10).send_keys(self.SI_NO_element, "test007") Browser(driver, 10).click(self.customs_broker_element) Browser(driver, 10).choice_select(self.customs_broker_choice_element) Browser(driver, 10).click(self.cargo_type_element) Browser(driver, 10).choice_select(self.cargo_type_choice_element) Browser(driver, 10).send_keys(self.INV_checklist_element, Keys.SPACE) driver.execute_script("var q=document.documentElement.scrollTop=0") Browser(driver, 10).click(self.file_upload_element) Browser(driver, 10).send_keys(self.INV_upload_element, Keys.SPACE) Browser(driver, 10).send_keys(self.upload_button_element, self.path) Browser(driver, 10).send_keys(self.close_button_element, Keys.ENTER) Browser(driver, 10).send_keys(self.BL_upload_element, Keys.SPACE) Browser(driver, 10).send_keys(self.upload_button_element, self.path) Browser(driver, 10).send_keys(self.close_button_element, Keys.ENTER) Browser(driver, 10).click(self.popup_return_element) Browser(driver, 10).click(self.temporary_saving_element) Browser(driver, 10).click(self.confirm_button_element) Wait(driver, 10).elementwait(lambda x: x.find_element(*self.return_element)) button = Browser(driver, 10).get_attribute(self.sending_confirmation_element, "style") if button == "display: none;": Browser(driver, 10).click(self.saving_element) else: Browser(driver, 10).click(self.sending_confirmation_element) Browser(driver, 10).click(self.sure_button_element) tips = Browser(driver, 10).get_text(self.windows_tips_element) Browser(driver, 10).click(self.confirm_element) Browser(driver, 10).click(self.return_element) return message, tips
def test27(self, driver): explain = "INV P/L登录有偿新规 test27输送形态不选择保存 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 有償新規 self.e.click(driver, 15, explain, *self.YouChangXinGui) # P/O で検出 self.e.click(driver, 15, explain, *self.YPOJianChu) sleep(4) # 检索 self.e.click(driver, 15, explain, *self.test24BL_jiansuo) # 点击任意一条数据 # self.e.click(driver, 15, explain, *self.test24BL_jiansuo) # driver.find_element(*self.test24BL_jiansuo).send_keys(Keys.SPACE) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test24BL_suijixuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test24BL_suijixuanze).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test19BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写商品数量 self.e.send_keys(driver, 15, self.test20shuliang, explain, *self.test19BL_shuliang) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.test20BL_shujuxuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.WplDengLu) # 填写识别番号 self.e.send_keys(driver, 15, self.test20shibiefanhao, explain, *self.test20BL_shibiefanhao) # 填写集装箱开始号 self.e.send_keys(driver, 15, self.test20csn, explain, *self.test20BL_csn) # 填写集装箱结束号 self.e.send_keys(driver, 15, self.test20cen, explain, *self.test20BL_cen) # 填写净重 self.e.send_keys(driver, 15, self.test20nw, explain, *self.test20BL_nw) # 填写毛重 self.e.send_keys(driver, 15, self.test20gw, explain, *self.test20BL_gw) # 填写体积 self.e.send_keys(driver, 15, self.test20m, explain, *self.test20BL_mt) driver.execute_script("var q=document.documentElement.scrollTop=0") # 填写I/V No self.e.send_keys(driver, 15, self.test20IVno, explain, *self.test20BL_ivno) # 选择I/V作成日 self.e.click(driver, 15, explain, *self.test20BL_ivdianji) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_ivday) # 选择積出港(判断是否自动带出) dp = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.DeliveryPort_element).get_attribute("value")) if dp == None: # 点击第一个 self.e.click(driver, 15, explain, *self.DeliveryPort_element) sleep(1) self.e.click(driver, 15, explain, *self.Select1st_element) # 选择輸送形態中 Sea海运 self.e.click(driver, 15, explain, *self.TransForm_element) sleep(1) self.e.click(driver, 15, explain, *self.TransSea_element) # 选择建値中 FCA货交承运人 mk = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.Market_element).get_attribute("value")) if mk == None: self.e.click(driver, 15, explain, *self.Market_element) sleep(1) self.e.click(driver, 15, explain, *self.FCA_element) # 选择陸揚港 up = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.UnloadPort_element).get_attribute("value")) if up == None: # 点击第二个 self.e.click(driver, 15, explain, *self.UnloadPort_element) sleep(1) self.e.click(driver, 15, explain, *self.Select2nd_element) # 选择通貨 cu = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.Currency_element).get_attribute("value")) if cu == None: self.e.clear(driver, 15, explain, *self.Currency_element) self.e.send_keys(driver, 15, "USD", explain, *self.Currency_element) sleep(1) self.e.click(driver, 15, explain, *self.SendCur_element) # 选择ETD预计到港日期 self.e.click(driver, 15, explain, *self.test20BL_etd) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_etdday) # 删除运输形态 self.e.click(driver, 15, explain, *self.YunshuxingtaiClear_element) # 判断 保存 按钮是否启用(启用返回TRUE,未启用FALSE) res = self.e.is_enabled(driver, 15, explain, *self.WBaoCun) if res == False: return "OK"
def test23(self, driver): explain = "INV P/L登录无償新規 test23选择新增的I/V NO订单记录编集不保存 " explain = "INV P/L登录有偿新规 test24填写基础情报信息I/V NO、I/V作成日、ETD保存且检索成功 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 无償新規 self.e.click(driver, 15, explain, *self.WuChangXinGui) # 点击 無償商品登録行追加 self.e.click(driver, 15, explain, *self.test19BL_shangpinzhuijia) sleep(2) # 检索 self.e.click(driver, 15, explain, *self.POSearch_element) sleep(4) # 点击任意一条数据 # driver.find_element(*self.test15BL_shuju).send_keys(Keys.SPACE) # self.e.click(driver, 15, explain, *self.test15BL_shuju) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test20BL_suijixuanzeshangpin)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test20BL_suijixuanzeshangpin).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test19BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写FOB单价 self.e.send_keys(driver, 15, self.test20danjia, explain, *self.test19BL_danjia) # 填写商品数量 self.e.send_keys(driver, 15, self.test20shuliang, explain, *self.test19BL_shuliang) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.test20BL_shujuxuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.WplDengLu) # 填写识别番号 self.e.send_keys(driver, 15, self.test20shibiefanhao, explain, *self.test20BL_shibiefanhao) # 填写集装箱开始号 self.e.send_keys(driver, 15, self.test20csn, explain, *self.test20BL_csn) # 填写集装箱结束号 self.e.send_keys(driver, 15, self.test20cen, explain, *self.test20BL_cen) # 填写净重 self.e.send_keys(driver, 15, self.test20nw, explain, *self.test20BL_nw) # 填写毛重 self.e.send_keys(driver, 15, self.test20gw, explain, *self.test20BL_gw) # 填写体积 self.e.send_keys(driver, 15, self.test20m, explain, *self.test20BL_mt) driver.execute_script("var q=document.documentElement.scrollTop=0") # 选择海外取引先 self.e.click(driver, 15, explain, *self.test20BL_haiwaiquyinxian) sleep(1) # 点击第一条 self.e.click(driver, 15, explain, *self.test20BL_quyinxiandianji) # 填写I/V No self.e.send_keys(driver, 15, self.test20IVno, explain, *self.test20BL_ivno) # 选择I/V作成日 self.e.click(driver, 15, explain, *self.test20BL_ivdianji) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_ivday) # 选择積出港 self.e.click(driver, 15, explain, *self.DeliveryPort_element) sleep(1) # 点击第一个 self.e.click(driver, 15, explain, *self.Select1st_element) # 选择輸送形態中 Sea海运 self.e.click(driver, 15, explain, *self.TransForm_element) sleep(1) self.e.click(driver, 15, explain, *self.TransSea_element) # 选择建値中 FCA货交承运人 self.e.send_keys(driver, 15, "FOB", explain, *self.test20BL_jianzhi) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_jianzhidianji) # 选择陸揚港 self.e.click(driver, 15, explain, *self.UnloadPort_element) sleep(1) # 点击第二个 self.e.click(driver, 15, explain, *self.Select2nd_element) # 选择通貨 self.e.send_keys(driver, 15, self.test20tonghuo, explain, *self.test20BL_tonghuo) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_tonghuodianji) # 选择ETD预计到港日期 self.e.click(driver, 15, explain, *self.test20BL_etd) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_etdday) # 点击保存 self.e.click(driver, 15, explain, *self.WBaoCun) # 点击确定 self.e.click(driver, 15, explain, *self.test20BL_quedingbaocun) # 点击关闭 self.e.click(driver, 15, explain, *self.WGuanBi) # 在检索条件中输入I/V NO self.e.send_keys(driver, 15, self.test20IVno, explain, *self.test24BL_IVNO) # 点击检索按钮 self.e.click(driver, 15, explain, *self.test21BL_jiansuo) # 数据选择 self.e.click(driver, 15, explain, *self.test21BL_xuanze) # 编集 self.e.click(driver, 15, explain, *self.test21BL_bianji) # 按钮 self.e.click(driver, 15, explain, *self.test22BL_jianzhianniu) # 选择建值 self.e.click(driver, 15, explain, *self.test22BL_jianzhixuanze) # 关闭 self.e.click(driver, 15, explain, *self.test23BL_guanbi) success_text = "OK" return success_text
def test24(self, driver): explain = "INV P/L登录有偿新规 test24填写基础情报信息I/V NO、I/V作成日、ETD保存且检索成功 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 有償新規 self.e.click(driver, 15, explain, *self.YouChangXinGui) # P/O で検出 self.e.click(driver, 15, explain, *self.YPOJianChu) sleep(4) # 检索 self.e.click(driver, 15, explain, *self.test24BL_jiansuo) sleep(2) # 点击任意一条数据 # self.e.click(driver, 15, explain, *self.test24BL_jiansuo) # driver.find_element(*self.test24BL_jiansuo).send_keys(Keys.SPACE) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test24BL_suijixuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test24BL_suijixuanze).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test19BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写商品数量 self.e.send_keys(driver, 15, self.test24shuliang, explain, *self.test24BL_shurushuliang) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.test24BL_shujuxuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.YPLDengLu) # 填写识别番号 self.e.send_keys(driver, 15, self.test24shibiefanhao, explain, *self.test24BL_shibiefanhao) # 填写集装箱开始号 self.e.send_keys(driver, 15, self.test24CartonStartNo, explain, *self.test24BL_CartonStartNo) # 填写集装箱结束号 self.e.send_keys(driver, 15, self.test24CartonEndNo, explain, *self.test24BL_CartonEndNo) # 填写净重 self.e.send_keys(driver, 15, self.test24nw, explain, *self.test24BL_nw) # 填写毛重 self.e.send_keys(driver, 15, self.test24gw, explain, *self.test24BL_gw) # 填写体积 self.e.send_keys(driver, 15, self.test24m3, explain, *self.test24BL_m3) driver.execute_script("var q=document.documentElement.scrollTop=0") # 填写I/V No self.e.send_keys(driver, 15, self.test24IVno, explain, *self.test24BL_IVNO) # 选择I/V作成日 self.e.click(driver, 15, explain, *self.test24BL_ivzuochengri) sleep(1) self.e.click(driver, 15, explain, *self.test24BL_ivday) # 选择積出港(判断是否自动带出) dp = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.DeliveryPort_element).get_attribute("value")) if dp == None: # 点击第一个 self.e.click(driver, 15, explain, *self.DeliveryPort_element) sleep(1) self.e.click(driver, 15, explain, *self.Select1st_element) # 选择輸送形態中 Sea海运 self.e.click(driver, 15, explain, *self.TransForm_element) sleep(1) self.e.click(driver, 15, explain, *self.TransSea_element) # 选择建値中 FCA货交承运人 mk = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.Market_element).get_attribute("value")) if mk == None: self.e.click(driver, 15, explain, *self.Market_element) sleep(1) self.e.click(driver, 15, explain, *self.FCA_element) # 选择陸揚港 up = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.UnloadPort_element).get_attribute("value")) if up == None: # 点击第二个 self.e.click(driver, 15, explain, *self.UnloadPort_element) sleep(1) self.e.click(driver, 15, explain, *self.Select2nd_element) # 选择通貨 cu = Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.Currency_element).get_attribute("value")) if cu == None: self.e.clear(driver, 15, explain, *self.Currency_element) self.e.send_keys(driver, 15, "USD", explain, *self.Currency_element) sleep(1) self.e.click(driver, 15, explain, *self.SendCur_element) # 选择ETD预计到港日期 self.e.click(driver, 15, explain, *self.test24BL_etd) sleep(1) self.e.click(driver, 15, explain, *self.test24BL_etdday) # 点击保存 self.e.click(driver, 15, explain, *self.test24BL_baocun) try: # 判断是否有積出港・陸揚港确定 dpup = self.e.getText(driver, 15, explain, *self.dpupinf) if dpup == "P/Oの積出港・陸揚港とINVの積出港・陸揚港が不一致ですが、次に進めますか?": self.e.click(driver, 20, explain, *self.dpupConf) except Exception as e: pass # 点击确定 self.e.click(driver, 15, explain, *self.test24BL_queren) # 点击关闭 self.e.click(driver, 15, explain, *self.test24BL_guanbi) # 在检索条件中输入I/V NO self.e.send_keys(driver, 15, self.test24IVno, explain, *self.test24BL_jiansuotiaojianIVNO) # 点击检索按钮 self.e.click(driver, 15, explain, *self.test24BL_JIANSUO) sleep(2) # 获取检索结果的I/V NO SearchIV = self.e.getText(driver, 15, explain, *self.test24BL_chaxunIVno) # return SearchIV, self.test24IVno return 'OK'
def test26(self, driver): explain = "INV P/L登录无偿新规 test26通货不选择保存 " # 点击 INV P/L登録 self.e.click(driver, 15, explain, *self.INVpldenglu) # 点击 无償新規 self.e.click(driver, 15, explain, *self.WuChangXinGui) # 点击 無償商品登録行追加 self.e.click(driver, 15, explain, *self.test19BL_shangpinzhuijia) sleep(2) # 检索 self.e.click(driver, 15, explain, *self.POSearch_element) sleep(4) # 点击任意一条数据 # driver.find_element(*self.test15BL_shuju).send_keys(Keys.SPACE) # self.e.click(driver, 15, explain, *self.test15BL_shuju) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test20BL_suijixuanzeshangpin)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test20BL_suijixuanzeshangpin).click()) # 点击使用 self.e.click(driver, 15, explain, *self.test19BL_shiyong) # 将滚动条移动到页面的底部 js = "var q=document.documentElement.scrollTop=1000" driver.execute_script(js) # 填写FOB单价 self.e.send_keys(driver, 15, self.test20danjia, explain, *self.test19BL_danjia) # 填写商品数量 self.e.send_keys(driver, 15, self.test20shuliang, explain, *self.test19BL_shuliang) """勾选所有INVOICE 详细添加到Package List详细""" # 勾选所有INVOICE 详细 self.e.click(driver, 15, explain, *self.test20BL_shujuxuanze) # 点击P/L登録 self.e.click(driver, 15, explain, *self.WplDengLu) # 填写识别番号 self.e.send_keys(driver, 15, self.test20shibiefanhao, explain, *self.test20BL_shibiefanhao) # 填写集装箱开始号 self.e.send_keys(driver, 15, self.test20csn, explain, *self.test20BL_csn) # 填写集装箱结束号 self.e.send_keys(driver, 15, self.test20cen, explain, *self.test20BL_cen) # 填写净重 self.e.send_keys(driver, 15, self.test20nw, explain, *self.test20BL_nw) # 填写毛重 self.e.send_keys(driver, 15, self.test20gw, explain, *self.test20BL_gw) # 填写体积 self.e.send_keys(driver, 15, self.test20m, explain, *self.test20BL_mt) driver.execute_script("var q=document.documentElement.scrollTop=0") # 选择海外取引先 self.e.click(driver, 15, explain, *self.test20BL_haiwaiquyinxian) sleep(1) # 点击第一条 self.e.click(driver, 15, explain, *self.test20BL_quyinxiandianji) # 填写I/V No self.e.send_keys(driver, 15, self.test20IVno, explain, *self.test20BL_ivno) # 选择I/V作成日 self.e.click(driver, 15, explain, *self.test20BL_ivdianji) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_ivday) # 选择積出港 self.e.click(driver, 15, explain, *self.DeliveryPort_element) sleep(1) # 点击第一个 self.e.click(driver, 15, explain, *self.Select1st_element) # 选择輸送形態中 Sea海运 self.e.click(driver, 15, explain, *self.TransForm_element) sleep(1) self.e.click(driver, 15, explain, *self.TransSea_element) # 选择建値中 FCA货交承运人 self.e.send_keys(driver, 15, "FOB", explain, *self.test20BL_jianzhi) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_jianzhidianji) # 选择陸揚港 self.e.click(driver, 15, explain, *self.UnloadPort_element) sleep(1) # 点击第二个 self.e.click(driver, 15, explain, *self.Select2nd_element) # 选择通貨 self.e.send_keys(driver, 15, self.test20tonghuo, explain, *self.test20BL_tonghuo) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_tonghuodianji) # 选择ETD预计到港日期 self.e.click(driver, 15, explain, *self.test20BL_etd) sleep(1) self.e.click(driver, 15, explain, *self.test20BL_etdday) # 删除通货 self.e.click(driver, 15, explain, *self.TonghuoClear_element) # 判断 保存 按钮是否启用(启用返回TRUE,未启用FALSE) res = self.e.is_enabled(driver, 15, explain, *self.WBaoCun) if res == False: return "OK"
def test20(self, driver): # INV 登录 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.INVpldenglu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.INVpldenglu).click()) # 无偿新规 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WuChangXinGui)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WuChangXinGui).click()) # 点击无偿商品登录行追加 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test19BL_shangpinzhuijia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_shangpinzhuijia).click()) # 选择商品信息表中的第一条数据 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test19BL_xuanzeshuju)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_xuanzeshuju).click()) # 点击使用 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test19BL_shiyong)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_shiyong).click()) # INVOICE详细中填写FOB单价、数量 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.test19BL_danjia)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_danjia).send_keys(self.test19danjia)) Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver. find_element(*self.test19BL_shuliang)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_shuliang).send_keys(self.test19shuliang)) # 点击P/L登录 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test19BL_shujuxuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_shujuxuanze).click()) Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WplDengLu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WplDengLu).click()) # Package List详细中选择数据 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver. find_element(*self.test19BL_PLxuanze)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test19BL_PLxuanze).click()) # 点击削除 Wait(driver, 10, 1).elementwait( lambda the_driver: the_driver.find_element(*self.WplXiaoChu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.WplXiaoChu).click()) # 是否消除 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test18BL_shifouxiaoshu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_shifouxiaoshu).click()) # 确认消除 Wait(driver, 10, 1).elementwait(lambda the_driver: the_driver.find_element( *self.test18BL_querenxiaochu)) Wait(driver, 10).until(lambda the_driver: the_driver.find_element( *self.test18BL_querenxiaochu).click()) Actual_result = driver.find_element(*self.test18BL_actual_result).text return Actual_result